Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
#!/usr/bin/python
import etk
icon = etk.Image()
icon.set_from_file('icon.png')
box = etk.VBox()
box.append(icon, etk.VBox.START, etk.VBox.FILL, 0)
w = etk.Window(title="Hello World", size_request=(300, 300), child=box)
w.on_destroyed(lambda x: etk.main_quit())
w.show_all()
etk.main()
button = etk.Button(label="Previous")
button.set_from_stock(etk.c_etk.StockEnums.GO_PREVIOUS)
button.on_clicked(prev_cb, notebook)
hbox.append(button, etk.HBox.START, etk.HBox.FILL, 0)
button = etk.Button(label="Next")
button.set_from_stock(etk.c_etk.StockEnums.GO_NEXT)
button.on_clicked(next_cb, notebook)
hbox.append(button, etk.HBox.START, etk.HBox.FILL, 0)
button = etk.ToggleButton(label="Hide tabs")
button.on_toggled(hide_tabs_toggled_cb, notebook)
hbox.append(button, etk.HBox.START, etk.HBox.FILL, 0)
w = etk.Window(title="Etk Notebook Example", size_request=(300, 300), child=main_vbox)
w.show_all()
def on_destroyed(obj):
etk.main_quit()
w.connect("destroyed", on_destroyed)
etk.main()
ce = etk.ComboboxEntry()
for t in ["Alpha", "Beta", "Gamma"]:
ce.item_append(t)
def show_active_item(c):
print c.active_item.field_get(0)
ce.on_active_item_changed(show_active_item)
# Main
box = etk.VBox()
box.append(combo, etk.VBox.START, etk.VBox.FILL, 0)
box.append(ce, etk.VBox.END, etk.VBox.FILL, 0)
w = etk.Window(title="Hello World", size_request=(300, 200), child=box)
w.on_destroyed(lambda x: etk.main_quit())
w.show_all()
etk.main()
#!/usr/bin/python
import etk
b1 = etk.Button(label="Button #1")
b2 = etk.Button(label="Button #2")
w = etk.Window(title="Swapping buttons", size_request=(200, 50), child=b1)
w.on_destroyed(lambda x: etk.main_quit())
def show(obj, child):
print "Added: " + child.label
return True
w.on_child_added(show)
def swap(obj, other):
w.child = other
other.show()
return True
b1.on_clicked(swap, b2)
b2.on_clicked(swap, b1)
e.text = ""
def click(b, e):
clear(e)
entry.text = 'some text'
entry.on_text_activated(clear)
bye = etk.Button(label="Click")
bye.on_clicked(click, entry)
box = etk.VBox()
box.append(entry, etk.VBox.START, etk.VBox.FILL, 0)
box.append(bye, etk.VBox.END, etk.VBox.NONE, 0)
w = etk.Window(title="Hello World", size_request=(300, 300), child=box)
w.on_destroyed(lambda x: etk.main_quit())
w.show_all()
etk.main()
return True
pos = 0
for name in ['One', 'Two', 'Three', 'Four', 'Five', 'Six']:
b = etk.Button(label=name)
b.connect("clicked", on_clicked)
row = pos / cols
col = pos % cols
t.attach_default(b, col, col, row, row)
pos += 1
bye = etk.Button(label="Hello World")
bye.connect("clicked", lambda x: etk.main_quit())
t.attach_default(bye, 0, 2, 2, 2)
w = etk.Window(title="Hello World", size_request=(300, 300), child=t)
w.show_all()
def on_destroyed(obj):
etk.main_quit()
w.connect("destroyed", on_destroyed)
etk.main()
return True
make_button("Remove selected", remove_selected, lst)
bsbox = etk.VBox()
for b in bs:
bsbox.append(b, etk.VBox.START, etk.VBox.FILL, 0)
# Main
box = etk.HBox()
box.append(bsbox, etk.HBox.START, etk.HBox.FILL, 0)
box.append(lst, etk.HBox.START, etk.HBox.EXPAND_FILL, 0)
w = etk.Window(title="Hello World", child=box)
w.on_destroyed(lambda x: etk.main_quit())
w.show_all()
etk.main()
model = etk.ListModel()
lst = etk.List(model=model, selectable=False, animated_changes=False,
row_height=150, columns=[
#(100, ImageRenderer(file_slot=0), False),
(200, ktr, True),
(175, mir, False),
])
lst.freeze()
for i in range(50):
model.append(["07-image/icon.png", "User #%d" % i, 0])
lst.thaw()
# Main
box = etk.VBox()
box.append(lst, etk.VBox.START, etk.VBox.EXPAND_FILL, 0)
w = etk.Window(title="Hello World", child=box)
w.on_destroyed(lambda x: etk.main_quit())
w.show_all()
etk.main()
counter += 1
x = etk.Button(label="Yet another button #%d" % counter)
box.append(x, etk.VBox.START, etk.VBox.FILL, 0)
x.show()
outer_box = etk.VBox()
box = etk.VBox()
adder = etk.Button(label="New Button")
adder.on_clicked(do_add, box)
sv = etk.ScrolledView()
sv.add_with_viewport(box)
outer_box.append(adder, etk.VBox.START, etk.VBox.FILL, 0)
outer_box.append(sv, etk.VBox.START, etk.VBox.EXPAND_FILL, 0)
w = etk.Window(title="Hello World", size_request=(200, 400), child=outer_box)
w.on_destroyed(lambda x: etk.main_quit())
w.show_all()
etk.main()
b1 = etk.Button(label="4 connects")
b1.on_clicked(click, 1)
b1.on_clicked(click, 2)
b1.on_clicked(click, 3)
b1.on_clicked(click, 4)
b2 = etk.Button(label="4 connects w/ a stop in the middle")
b2.on_clicked(click, 1)
b2.on_clicked(click, 2)
b2.on_clicked(click, 3, stop=True)
b2.on_clicked(click, 4)
exit = etk.Button(label="Exit")
exit.on_clicked(lambda x: etk.main_quit())
box = etk.VBox()
box.append(b1, etk.VBox.END, etk.VBox.FILL, 0)
box.append(b2, etk.VBox.END, etk.VBox.FILL, 0)
box.append(exit, etk.VBox.END, etk.VBox.FILL, 0)
w = etk.Window(title="Hello World", child=box)
def delete(o, n, stop=False):
print "delete-event number #%d" % n
if stop:
print "STOP!"
return False
else:
return True
w.on_delete_event(delete, 1)
w.connect_after("delete-event", delete, 2, stop=True)