mercredi 30 janvier 2019

GTK Application for scrolling H

I am a Linux Kernel developer, we have a board running Yocto Image, got a requirement to display "A full black screen with scrolling H’s " for CISPR test. I am using GTK Library to this, Wrote a sample Code which blanks the whole screen and write "Hello World" on to the centre.

#include <gtk/gtk.h>
int main (int argc, char *argv[])
{
    GtkWidget *window;// GtkWidget is the storage type for widgets
    GtkWidget *label;
    gtk_init (&argc, &argv);// This is called in all GTK applications. Arguments are parsed
                        //from the command line and are returned to the application.
    window=gtk_window_new(GTK_WINDOW_TOPLEVEL); //creating a new window.
    label = gtk_label_new("Hello World");
    gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
    gtk_container_add(GTK_CONTAINER(window), label);
    gtk_window_set_decorated(GTK_WINDOW(window), FALSE);
    GdkCursor* Cursor = gdk_cursor_new(GDK_BLANK_CURSOR);
    GdkWindow* win = gtk_widget_get_window((window));
    gdk_window_set_cursor((win),Cursor);
    gtk_widget_show_all(window); //The final step is to display this newly created widget.
   gtk_main (); //All GTK applications must have a gtk_main(). Control ends here
                       //and waits for an event to occur (like a key press or mouse event).
   return 0;
}

As I am a newbie in GUI, can anyone guide me what all widgets should I use to get the scrolling H's.

https://www.youtube.com/watch?v=PWkuqyC3AWk

Aucun commentaire:

Enregistrer un commentaire