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()
#!/usr/bin/python
import etk
cols = 1
rows = 2
helpImage = etk.Image()
helpImage.set_from_stock(etk.c_etk.StockEnums.HELP_BROWSER, etk.c_etk.StockEnums.SMALL)
def giveHelp(menu):
print 'Sorry! :)'
t = etk.Table(cols=cols, rows=rows, homogeneous=etk.Table.NOT_HOMOGENEOUS)
mb = etk.MenuBar()
menuFileButton = etk.MenuItem(label='File')
menuHelpButton = etk.MenuItemImage(label='Help!')
menuHelpButton.image = helpImage #this image won't be displayed in the menubar
menuHelpButton.on_activated(giveHelp) #this event is not triggered
menuSeparator = etk.MenuItemSeparator()
#MenuFile
#!/usr/bin/python
import etk
# Combobox
combo = etk.Combobox(columns=[
(etk.Combobox.IMAGE, 50, etk.Combobox.FILL, 0.0),
(etk.Combobox.LABEL, 50, etk.Combobox.FILL, 1.0),
(etk.Combobox.OTHER, 20, etk.Combobox.FILL, 0.0)])
combo.items_height = 50
def show(b, text):
print text
for i, v in enumerate(["XXX", "ABCABC", "P", "JJJJJ"]):
f = etk.Image()
f.set_from_file('07-image/icon.png')
b = etk.Button(label="?")
b.on_clicked(show, "I don't know what is %s" % v)
combo.item_append(f, v, b)
def show_item(c, i):
print i.field_get(1)
combo.on_item_activated(show_item)
# ComboboxEntry
ce = etk.ComboboxEntry()
for t in ["Alpha", "Beta", "Gamma"]:
ce.item_append(t)
#!/usr/bin/python
import etk
##################################
## Create Widget for the first tab
image = etk.Image()
image.set_from_stock (etk.c_etk.StockEnums.APPLICATIONS_DEVELOPMENT, etk.c_etk.StockEnums.BIG)
buttons = [etk.Button(), etk.CheckButton(), etk.CheckButton()]
buttons[0].set_from_stock (etk.c_etk.StockEnums.DOCUMENT_OPEN)
labels = [etk.Label(text="App Name"), etk.Label(text="Generic Info"),
etk.Label(text="Comments"), etk.Label(text="Executable"),
etk.Label(text="Window Name"),etk.Label(text="Window Class"),
etk.Label(text="Startup Notify"),etk.Label(text="Wait Exit")]
entries = [etk.Entry() for i in range(6)]
table = etk.Table(cols=2, rows=10, homogeneous=etk.Table.NOT_HOMOGENEOUS)
table.attach(image, 0, 0, 0, 0, etk.Table.NONE, 0, 0)
table.attach(buttons[0], 1, 1, 0, 0, etk.Table.HEXPAND, 0, 0)