Giter Site home page Giter Site logo

code-in-place-python-kivy's Introduction

Code In Place Final Project ๐ŸŒฟ ๐ŸŒฑ ๐ŸŒท

"Code in Place is a free introductory programming course using the Python language, based on material from the first half of Stanford University's established intro course, CS106A. "

๐Ÿ“ฃ More info: here

About this project ๐Ÿพ

It is a project where I am summarizing everything I have learned in Code In Place:

  • Lists
  • Dictionaries
  • Images
  • Control Flow.

I have included a new library that I learned to create interfaces with Python, this library is Kivy Python. ๐Ÿš™

How to use it: ๐ŸŽƒ

python3 final_project.py
import kivy
from kivy.app import App 
from kivy.uix.label import Label 
from kivy.uix.gridlayout import GridLayout
from kivy.uix.textinput import TextInput
from kivy.uix.button import Button
from kivy.uix.widget import Widget
from kivy.properties import ObjectProperty
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.boxlayout import BoxLayout
from kivy.lang import Builder
from kivy.uix.popup import Popup
from simpleimage import SimpleImage
from Q5_extensions import set_all_patchs
import random
import os

# Colors
red = [1, 0, 0, 1] 
green = [0, 1, 0, 1] 
blue = [0, 0, 1, 1] 
purple = [1, 0, 1, 1] 

# Image properties
N_ROWS = 3
N_COLS = 3
PATCH_SIZE = 200
WIDTH = N_COLS * PATCH_SIZE
HEIGHT = N_ROWS * PATCH_SIZE


list = ["img/list.png", "img/dictionary.png", "img/control_flow.png"]

class PL(FloatLayout):
    def btn5_list(self):
        patch = SimpleImage(list[0])
        patch.show()

class PD(FloatLayout):
    def btn6_dicc(self):
        patch = SimpleImage(list[1])
        patch.show()

class PCF(FloatLayout):
    def btn7_cf(self):
        patch = SimpleImage(list[2])
        patch.show()

class PI(FloatLayout):
    def btn4_images(self):
        warhols_image = SimpleImage.blank(WIDTH, HEIGHT)
        set_all_patchs(warhols_image)
        warhols_image.show()

class PS(FloatLayout):
    def btn8_surprise(self):
        patch = SimpleImage('img/uu.gif')
        patch.show()

class MyGrid(GridLayout):
    mlist = ObjectProperty(None)
    dicc = ObjectProperty(None)
    
    def btn1(self):
        show_popup_list()    
    def btn2(self):
        show_popup_dicc()
    def btn3(self):
        show_popup_cf()
    def btn4(self):
        show_popup_images()
    def btn5(self):
        show_popup_surprise()


def show_popup_list():
    show = PL()
    popupWindow = Popup(title="Code In Place", content=show, size_hint=(None, None), size=(450,450))
    popupWindow.open()

def show_popup_dicc():
    show = PD()
    popupWindow = Popup(title="Code In Place", content=show, size_hint=(None, None), size=(450,450))
    popupWindow.open()

def show_popup_cf():
    show = PCF()
    popupWindow = Popup(title="Code In Place", content=show, size_hint=(None, None), size=(450,450))
    popupWindow.open()

def show_popup_images():
    show = PI()
    popupWindow = Popup(title="Code In Place", content=show, size_hint=(None, None), size=(450,450))
    popupWindow.open()      

def show_popup_surprise():
    show = PS()
    popupWindow = Popup(title="Code In Place", content=show, size_hint=(None, None), size=(450,450))
    popupWindow.open()

class MyApp(App):
    
    def build(self):
        return MyGrid()  
    
if __name__ == "__main__":
    MyApp().run()

Graphical interface of this project ๐Ÿ‘ป

Thanks Code In Place!

code-in-place-python-kivy's People

Contributors

edithturn avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.