Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Gnome/examples/   (Gnome Linux Desktop Version 4.23.2©)  Datei vom 30.5.2026 mit Größe 1 kB image not shown  

Quelle  squares.py

  Sprache: Python
 

#!/usr/bin/env -S GI_TYPELIB_PATH=${PWD}/build/gtk:${GI_TYPELIB_PATH} LD_PRELOAD=${LD_PRELOAD}:${PWD}/build/gtk/libgtk-4.so python3

import gi

gi.require_version('Gdk''4.0')
gi.require_version('Gtk''4.0')

from gi.repository import Gdk
from gi.repository import Gtk
from gi.repository import Graphene


class DemoWidget(Gtk.Widget):

    __gtype_name__ = "DemoWidget"

    def __init__(self):
        super().__init__()

    def do_measure(self, orientation, for_size: int):
        # We need some space to draw
        return 100200, -1, -1

    def do_snapshot(self, snapshot):
        # Draw four color squares
        color = Gdk.RGBA()
        rect = Graphene.Rect.alloc()

        width = self.get_width() / 2
        height = self.get_height() / 2

        Gdk.RGBA.parse(color, "red")
        rect.init(00, width, height)
        snapshot.append_color(color, rect)

        Gdk.RGBA.parse(color, "green")
        rect.init(width, 0, width, height)
        snapshot.append_color(color, rect)

        Gdk.RGBA.parse(color, "yellow")
        rect.init(0, height, width, height)
        snapshot.append_color(color, rect)

        Gdk.RGBA.parse(color, "blue")
        rect.init(width, height, width, height)
        snapshot.append_color(color, rect)

def on_activate(app):
    # Create a new window
    win = Gtk.ApplicationWindow(application=app)
    win.set_title("Squares")
    icon = DemoWidget()
    win.set_child(icon)
    win.present()

# Create a new application
app = Gtk.Application(application_id='org.gtk.exampleapp')
app.connect('activate', on_activate)

# Run the application
app.run(None)

Messung V0.5 in Prozent
C=98 H=99 G=98

¤ Dauer der Verarbeitung: 0.15 Sekunden  (vorverarbeitet am  2026-07-03) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.