Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python project to greet you #156

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions Programs/Namaste.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
from kivy.app import App
from kivy.uix.gridlayout import GridLayout
from kivy.uix.label import Label
from kivy.uix.button import Button
from kivy.uix.textinput import TextInput
from kivy.core.window import Window

class Namaste(App):
def build(self):
self.window = GridLayout()
self.window.cols = 1
self.window.size_hint = (0.6, 0.7)
self.window.pos_hint = {"center_x": 0.5, "center_y":0.5}



# self.window.add_widget(Image(source="hello.jpg"))


self.greeting = Label(
text="what's your name?",
font_size = 20,
color='#ff6b81',
)
self.window.add_widget(self.greeting)

self.user = TextInput(
multiline=False,
padding_y = (20,20),
size_hint = (1, 0.5)
)
self.window.add_widget(self.user)

self.button = Button(
text = "Click me!",
size_hint = (1, 0.5),
bold = True,
background_color = '#ff6b81')
self.button.bind(on_press=self.callback)
self.window.add_widget(self.button)

return self.window

def callback(self, instance):
self.greeting.text = "Namaste "+ self.user.text + "!"

if __name__ == "__main__":
Namaste().run()