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()
#!/usr/bin/python
import etk
import ecore
c = etk.Canvas()
w = etk.Window(title="Button", size_request=(200, 200), child=c)
w.show_all()
evas = c.toplevel_evas_get()
r = evas.Rectangle(color="#ff0000", size=(50,50))
r.show()
bla = c.object_add(r)
print bla
def mover(obj):
(x, y) = c.child_position_get(bla)
c.move(bla, x + 1, y + 1)
return True
ecore.animator_add(mover, r)
import etk
counter = 0
msg = "Button clicked %d times"
b = etk.Button(label=msg % counter)
b_block = etk.Button(label="Block action")
b_block_false = etk.Button(label="Block other action")
b_unblock = etk.Button(label="Unblock action")
v = etk.VBox()
v.append(b, etk.VBox.END, etk.VBox.NONE, 0)
v.append(b_block, etk.VBox.END, etk.VBox.NONE, 0)
v.append(b_block_false, etk.VBox.END, etk.VBox.NONE, 0)
v.append(b_unblock, etk.VBox.END, etk.VBox.NONE, 0)
w = etk.Window(title="Button", size_request=(200, 200), child=v)
w.show_all()
def count(b, a):
global counter
counter += 1
b.label = msg % counter
print "button %s clicked" % b
return True
b.on_clicked(count, 13)
def do_block(button, b):
b.block("clicked", count, 13)
return True
b_block.on_clicked(do_block, b)
def do_block_false(button, b):