Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
AnderSchofield authored Jul 20, 2023
1 parent ee6eda7 commit dd4b02a
Showing 1 changed file with 0 additions and 49 deletions.
49 changes: 0 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,52 +20,3 @@ This application is a tool developed using kivy framework's tool KvViewer. I've

This project was built using the [Kivy](https://kivy.org/#home) open source Python library for developing multitouch applications. It's a community project and wouldn't exist without the support and dedication of many individuals. I'd like to thank the Kivy community for their valuable contributions and for making such a powerful tool available to developers.

## Example

```python
# Paste your final python code here
import textwrap
from kivy.lang import Builder
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.textinput import TextInput
from kivy.uix.label import Label
from kivy.core.window import Window

class KvApp(App):
def build(self):
# Set the window size to 1200x800 pixels
Window.size = (1200, 800)

self.root = BoxLayout(orientation='horizontal')

# Create a Text Input for KV code
self.kv_input = TextInput(size_hint_x=0.5)
self.kv_input.bind(text=self.update)
self.root.add_widget(self.kv_input)

# Create widget placeholder
self.kv_display = Label(size_hint_x=0.5)
self.root.add_widget(self.kv_display)

return self.root


# ... in the KvViewerApp class ...

def update(self, instance, value)
self.root.remove_widget(self.kv_display)
try:
# Use textwrap.dedent on value to remove any common leading whitespace
self.kv_display = Builder.load_string(textwrap.dedent(value))
self.kv_display.size_hint_x = 0.5
self.root.add_widget(self.kv_display)
except Exception as e:
self.kv_display = Label(text=str(e), size_hint_x=0.5)
self.root.add_widget(self.kv_display)

if __name__ == '__main__':
KvApp().run()



0 comments on commit dd4b02a

Please sign in to comment.