Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<pre><code>## All you need is this class: class MainWindow(Window): my_button = Button('Click Me') my_paragraph = Text('This is the text you wish to place') my_alert = AlertBox('What what what!!!') @my_button.clicked def my_button_clicked(self, button, event): self.my_paragraph.text.append('And now you clicked on it, the button that is.') @my_paragraph.text.changed def my_paragraph_text_changed(self, text, event): self.button.text = 'No more clicks!' @my_button.text.changed def my_button_text_changed(self, text, event): self.my_alert.show() ## The Style class is automatically gnerated by the framework ## but you can override it by defining it in the class: ## ## class MainWindow(Window): ## class Style: ## my_blah = {'style-info': 'value'} ## ## or like you see below: class Style: my_button = { 'background-color': '#ccc', 'font-size': '14px'} my_paragraph = { 'background-color': '#fff', 'color': '#000', 'font-size': '14px', 'border': '1px solid black', 'border-radius': '3px'} MainWindow.Style = Style ## The layout class is automatically generated ## by the framework but you can override it by defining it ## in the class, same as the Style class above, or by ## defining it like this: class MainLayout(Layout): def __init__(self, style): # It takes the custom or automatically generated style class upon instantiation style.window.pack(HBox().pack(style.my_paragraph, style.my_button)) MainWindow.Layout = MainLayout if __name__ == '__main__': run(App(main=MainWindow)) </code></pre> <p>It would be relatively easy to do in python with a bit of that metaclass python magic know how. Which I have. And a knowledge of PyGTK. Which I also have. Gets ideas?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload