Last active
December 12, 2018 08:00
-
-
Save kojix2/c5b79686211461bbb03139ab4de5bdb4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'datasets-gdk-pixbuf' | |
require 'gtk3' | |
n = ARGV[0].to_i | |
w = Gtk::Window.new | |
w.set_size_request(600,600) | |
flowbox = Gtk::FlowBox.new | |
flowbox.valign = :start | |
flowbox.selection_mode = :none | |
cifar = Datasets::CIFAR.new | |
cifar.each.with_index do |record, i| | |
if i < n | |
pixbuf = record.to_gdk_pixbuf | |
img = Gtk::Image.new(pixbuf: pixbuf) | |
button = Gtk::Button.new | |
button.image = img | |
flowbox.add button | |
end | |
end | |
w.add flowbox | |
w.show_all | |
Gtk.main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment