GTK+ Toolkit?


24 posts
by cbegg50 » Thu Jun 21, 2012 6:34 am
As an alternative to the X11 version of wxWidgets, I noticed there was a GTK version, and thought Raspberry Pi might support it. Its not there either and apt-get is not finding it either. Does anyone know how to get any graphics programming which is supported by wxWidgets to install on the RasPi? This is getting quite frustrating.

Regards,
Colin Begg
Posts: 15
Joined: Sat Jun 16, 2012 10:32 pm
by mscala » Sun Jul 15, 2012 8:54 pm
I'm using the Arch image from the download page, and wxgtk and wxpython in its repo.

Mark
Posts: 1
Joined: Mon Jul 09, 2012 11:11 pm
by cbegg50 » Sun Jul 15, 2012 9:36 pm
Hi Mark,
I was disappointed with the Debian distro when using it for serious C++ development so tried the ArchLinux one. After getting X up, first using Enlightenment (not impressed) then switching to good old LXDE and adding Midori (and NTP to stop confusing Make!), I got wxWidgets built (the package which needed GTK+).

Part way through that, I filled the 1.8Gb partition ArchLinux installs into and had to run up Ubuntu on an old Netbook to expand the partition to fill the 16Gb SDHC I'd put it onto. Then the build completed OK.

I'm now onto building the RocRail software to control my model railway using the Raspberry Pi with DCC and Loconet. That's my purpose for the Raspberry Pi!

So, with perseverance, the ArchLinux distro can do more serious development.

Regards,
Colin Begg
Posts: 15
Joined: Sat Jun 16, 2012 10:32 pm
by savage » Mon Aug 06, 2012 6:10 pm
control model railroad, you say?
Pictures!
Please!
-r
-=-
-=-
Posts: 1
Joined: Mon Aug 06, 2012 12:16 am
by cbegg50 » Mon Aug 06, 2012 7:00 pm
Screen photo of my Raspberry Pi running Rocrail, as requested! Not sure how long it'll last, its from a Pinterest cache.

Image

Alternatively: http://pinterest.com/pin/38773246762670497/
Just gotta get the wireless network going for iPhone / iPad throttles.

All the best
Colin
Posts: 15
Joined: Sat Jun 16, 2012 10:32 pm
by lb » Mon Aug 06, 2012 7:17 pm
I can only recommend to use GTK (with the excellent PyGTK bindings) directly instead. wx is badly designed, badly documented, buggy and a lot of bloat. The Python bindings are a mess, too.

I've used a lot of UI toolkits, and wx is about the worst I've seen yet.
Posts: 193
Joined: Sat Jan 28, 2012 8:07 pm
by BlackJack » Mon Aug 06, 2012 8:10 pm
@cbegg50: I have `python-wxgtk2.8` and the necessary dependencies installed from the repositories in Raspbian.
Code: Select all
while not self.asleep():
    sheep += 1
Posts: 288
Joined: Sat Aug 04, 2012 8:28 am
by cbegg50 » Mon Aug 06, 2012 8:38 pm
My Raspian distro didn't include wxGTK, is 'python-wxgtk2.8' the package I need to install?

Thanks,
Colin Begg
Posts: 15
Joined: Sat Jun 16, 2012 10:32 pm
by BlackJack » Mon Aug 06, 2012 10:14 pm
If you want to program in Python then yes. If you want to program in C++ it is `libwxgtk2.8` and `libwxgtk2.8-dev`.
Code: Select all
while not self.asleep():
    sheep += 1
Posts: 288
Joined: Sat Aug 04, 2012 8:28 am
by cbegg50 » Tue Aug 07, 2012 6:12 am
Yes, its C++. Together with libwxbase2.8 and libwxbase2.8-dev (I think) which pulled in the includes and libs I needed to build Rocrail on Raspbian, as you can see:

Image
Posts: 15
Joined: Sat Jun 16, 2012 10:32 pm
by Aquaticpenguin » Tue Aug 07, 2012 9:14 pm
lb wrote:I can only recommend to use GTK (with the excellent PyGTK bindings) directly instead. wx is badly designed, badly documented, buggy and a lot of bloat. The Python bindings are a mess, too.

I've used a lot of UI toolkits, and wx is about the worst I've seen yet.


I would also suggest avoiding wx. I've been using it and have just found it to be convoluted and counter-intuitive, and while it is cross-platform I've found some annoying discrepancies which appeared when porting from windows.
Posts: 1
Joined: Sun Jul 08, 2012 9:16 pm
by cbegg50 » Wed Aug 08, 2012 7:10 am
If I want to run RocRail model train control software, I have no choice. WxWidgets is what it uses for cross-platform graphics. RocRail runs on PC, MAC and various flavours of Linux (Raspberry Pi varieties now included). I don't doubt there are better graphics toolkits, but I don't fancy writing my own DCC software from scratch, when RocRail works so well.

Best Regards,
Colin Begg
Posts: 15
Joined: Sat Jun 16, 2012 10:32 pm
by pwinwood » Wed Aug 08, 2012 7:33 am
Aquaticpenguin wrote:I would also suggest avoiding wx. I've been using it and have just found it to be convoluted and counter-intuitive, and while it is cross-platform I've found some annoying discrepancies which appeared when porting from windows.


I disagree strongly with this observation. I am the original author of wxLua (wxlua.sourceforge.net) - which runs fine on the Pi BTW, and I had very few problems with wx. There were are very few incompatibilities between the platforms. Wx and wxPython is used by many shipping applications.
Posts: 54
Joined: Mon Jul 02, 2012 2:21 am
Location: Oxford, England
by jackokring » Sun Aug 12, 2012 5:42 am
I heard there was a GTK+ which skipped using X, and worked on the direct framebuffer. Also Qt works without X, (the right version). If X's only reasons for being are to open a graphics surface... done... provide a toolkit abstraction few use any more... make a compatibility layer to GTK+ or Qt... Even Tcl/Tk seems to be going down the native widget look... Open a xsession on another device over a network using a much maligned protocol ... when the vertex group of the display is what should be sent....

X11 should be replaced by G12, or whatever it gets called, and it should provide a hook so Qt windows can open too.

Cheers Jacko
Pi=B256R0USB CL4SD8GB Raspbian Stock. https://sites.google.com/site/rubikcompression/strictly-long https://dl.dropboxusercontent.com/u/1615413/Own%20Work/Leptronics.pdf https://groups.google.com/forum/#!topic/comp.compression/t22ct_BKi9w
User avatar
Posts: 784
Joined: Tue Jul 31, 2012 8:27 am
Location: London, UK
by zenod » Thu Aug 23, 2012 12:26 am
Colin,

Please (pretty please!!) can you make your compiled version of Rocrail available to the community, or failing that just me :) I'll take it warts and all, the current version is stable enough for my limited usage of the software.

My purpose in acquiring a Raspberry Pi was exactly the same as yours - in order to run Rocrail.

Failing that, then an idiots guide on how to port the code would be appreciated.

Good Job!
Posts: 6
Joined: Wed Aug 22, 2012 12:29 am
by zenod » Thu Aug 23, 2012 5:15 pm
Rocrail/Rocview cross compiled and running successfully (albeit slowly) on a Pi version 2, using the instructions given on Rocrail wiki - no issues.

Build time was approx. 4 hours, reminds me of the bad old days!
Posts: 6
Joined: Wed Aug 22, 2012 12:29 am
by PaulCheffus » Fri Aug 24, 2012 11:27 am
cbegg50 wrote:If I want to run RocRail model train control software, I have no choice. WxWidgets is what it uses for cross-platform graphics. RocRail runs on PC, MAC and various flavours of Linux (Raspberry Pi varieties now included). I don't doubt there are better graphics toolkits, but I don't fancy writing my own DCC software from scratch, when RocRail works so well.

Best Regards,
Colin Begg


Hi

Does RocRail support the Lenz system or is it just the Roco one?

Cheers

Paul
Procrastination - The Thief of Time.
Posts: 372
Joined: Tue May 29, 2012 2:51 pm
Location: Lincolnshire UK
by zenod » Sat Dec 15, 2012 10:48 pm
Hi Paul,

Rocrail has no relationship to Roco. It supports a whole host of DCC systems including Lenz. It also has been transferred to many different operating systems.

You will find further information at http://wiki.rocrail.net/doku.php There is an install package for Raspberry.
Last edited by zenod on Sat Dec 15, 2012 11:17 pm, edited 1 time in total.
Posts: 6
Joined: Wed Aug 22, 2012 12:29 am
by zenod » Sat Dec 15, 2012 11:16 pm
Hi,

I resurrected my Raspberry this weekend and the o/s performance is markedly improved, more stable and faster, than the original release.

I am currently rebuilding Rocrail/Rocview from the current source. I hope that Rocrail (the server) will now be usable on the Raspberry. I am not holding out any hopes for Rocview at the moment.

Will post again later.

Regards

Zenod
Posts: 6
Joined: Wed Aug 22, 2012 12:29 am
by zenod » Tue Dec 18, 2012 1:09 am
Hi,

I am pleased to report that I have had good success with the Rocrail model railway control system on the Rpi.

Several months ago, the Raspberry pi was unstable in several area. It was so bad that I put mine away for a while.

There is a marked improvement now with USB drivers, wireless dongles, serial dongles, networking and performance. My RPI is a version "B" 256m.

The USB issues I encountered earlier have been resolved. I have installed a wireless lan adaptor and a serial to DCC convertor, Locobuffer 2 for Digitrax hardware. Incidentally I have also successfully tested an earlier RS232 version of locobuffer (from Hans de Loof) with a serial dongle.

My setup now includes a full Webmin installation for administration (!).

Here is the RR-Cirkits interface being recognised on my system.

Dec 17 23:45:47 raspberrypi kernel: [ 953.838477] usb 1-1.3: New USB device found, idVendor=0403, idProduct=c7d0
Dec 17 23:45:47 raspberrypi kernel: [ 953.838505] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Dec 17 23:45:47 raspberrypi kernel: [ 953.838523] usb 1-1.3: Product: LocoBuffer-USB
Dec 17 23:45:47 raspberrypi kernel: [ 953.838536] usb 1-1.3: Manufacturer: RR-CirKits


I successfully rebuilt Rocrail from source using a recent nightly release using a nfs connected network drive. The instructions for rebuilding are on the Rocrail website(Incidentally there is a pre-compiled download available for the RPI of an earlier version of Rocrail for download).

Rocrail consists of a server (Rocrail) plus a viewer (Rocview). I was really only interested in the server part but found that Rocview did run, slowly, on my setup. That is not surprising as I am connecting remotely through a wireless link.

Here are a few lines from the Rocrail logs as it started up on my machine.

TM and Copyright 2002-2012 Rob Versluis.
All Rights Reserved.
r.j.versluis@rocrail.net
http://www.rocrail.net
License: GNU GPL 2
http://www.gnu.org/licenses/gpl.txt
Without an official permission commercial use is not permitted.
--------------------------------------------------
Rocrail 2.0 "Sunrise"
Revision: 4423
Build: Dec 16 2012 16:24:23
librocs 2.0-0 build Dec 16 2012 16:20:01
processid = 2792
....
20121217.235046.206 r9999I clocktic OLocoNet 1668 Got fast clock slot
20121217.235046.209 r9999I clocktic OLocoNet 1680 set clock
20121217.235046.273 r9999c clocktic lnmon 1060 Write Fast Clock: (Data is Valid)


I have no performance issue with Rocrail server so far being able to connect to the wireless Rocrail server and control the trains and layout, manually or automatically, remotely from any computer that can run Rocview. This includes Windows, Linux and Mac computers. There is also an app for Android devices which turns a smart device into a throttle.

Regards and Happy Christmas.
Posts: 6
Joined: Wed Aug 22, 2012 12:29 am
by arti0504 » Thu Feb 07, 2013 8:05 am
Hi

I would like connect library GTK+ and wiringPi. I use this code:

#include <gtk/gtk.h>

int main (int argc, char *argv[]) {
GtkWidget *okno;

gtk_init (&argc, &argv);

okno = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_show (okno);

gtk_main ();

return 0;
}

and I would like add:
#include <stdio.h>
#include <wiringPi.h>

int main (void)
{
printf (“Raspberry Pi blink\n”) ;

if (wiringPiSetup () == -1)
return 1 ;

pinMode (0, OUTPUT) ; // aka BCM_GPIO pin 17

for (;;)
{
digitalWrite (0, 1) ; // On LED podlaczona do GPIO
delay (500) ; // mS
digitalWrite (0, 0) ; // Off LED podlaczona do GPIO
delay (500) ;
}
return 0 ;
}

I added this code
digitalWrite (0, 1) ; // On LED podlaczona do GPIO
delay (500) ; // mS
digitalWrite (0, 0) ; // Off LED podlaczona do GPIO
delay (500) ;

in function of gtk_main (), but when you add the braces is
I get an error that missing semicolons.

Could you tell me, which function I must add this code?
Posts: 18
Joined: Wed Jan 30, 2013 8:40 am
by PeterO » Thu Feb 07, 2013 9:55 am
That is a call to "gtk_main" not the definition of the function. Once you've called gtk_main() you loose direct control and gtk_main only returns when the gui exits.

To get things to happen asynchronously once gtk is in control you will need to add a timer and a callback handler.

Have a look at the timer example on this web page : http://zetcode.com/tutorials/gtktutorial/gtkevents/

HTH

PeterO
User avatar
Posts: 737
Joined: Sun Jul 22, 2012 4:14 pm
by GrahamBriggs » Sun Jun 09, 2013 10:50 am
lb wrote:I can only recommend to use GTK (with the excellent PyGTK bindings) ...


Have you been able to get GTK to build on the RPi?

I am using Eclipse Juno on Ubuntu machine and a RPi. I have simple hello world application that I can build and debug on the Ubuntu machine, but when I try to build for the Pi, it fails.

I have configured my cross compiler toolchain according to hertaville.com. I can compile and run a program without gtk on the pi, but when I try to build the program with the gtk objects in it to display a simple window, it fails to compile on the Pi.

Error:
Code: Select all
/home/gbriggs/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/../lib/gcc/arm-linux-gnueabihf/4.7.2/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lgtk-3   ...  //  followed by one for each of the included libraries, then the whole 11 errors are repeated again (once for each library)


It appears as if this build configuration can not find the libraries in question? I suspect that I am missing library path somewhere (I notice that the pkg-config command is looking in the place where I installed raspberry pi tools, not in usr/)?

Any help or advice is appreciated

Thank you

GB
Posts: 9
Joined: Wed Jun 05, 2013 6:42 am
Location: Corvallis, OR
by pmc » Fri Jun 28, 2013 3:27 am
You need to install the gtk libraries

apt-get install libgtk2.0 devhelp

will actually setup version 3 and the `devhelp' is the docs for all that can be done and more.
Posts: 23
Joined: Sun Mar 31, 2013 8:07 pm