Skip to content

Instantly share code, notes, and snippets.

View Mr-Coxall's full-sized avatar

Patrick Coxall Mr-Coxall

  • St. Mother Teresa HS
  • Ottawa
View GitHub Profile
@Mr-Coxall
Mr-Coxall / images.py
Created September 19, 2016 16:43
images.pyui
# comment
import ui
my_pic = ui.Image.named('./sprites/MT_crest.jpg')
my_image = ui.ImageView(frame=(1024, 0,100,150))
my_image.image = my_pic
view = ui.load_view()
@Mr-Coxall
Mr-Coxall / images.py
Created September 21, 2016 16:19
images.pyui
# Created by: Mr. Coxall
# Created on: Aug 2016
# Created for: ICS3U
# This program shows images
import ui
# first get a reference to the image you saved in your Python folder
my_pic = ui.Image.named('./sprites/MT_crest.jpg')
@Mr-Coxall
Mr-Coxall / too_many_students.py
Created September 22, 2016 02:41
too_many_students.py
# Created by: Mr. Coxall
# Created on: Sep 2016
# Created for: ICS3U
# This program shows how to use an if statement
import ui
MAX_NUMBER_OF_STUDENTS = 24
def check_number_of_students_touch_up_inside(sender):
@Mr-Coxall
Mr-Coxall / revised_scene_management.py
Created September 26, 2016 16:45
revised_scene_management.py
# for use with https://github.com/omz/PythonistaAppTemplate
from scene import *
import ui
import time
class FirstScene(Scene):
def setup(self):
# get starting time
@Mr-Coxall
Mr-Coxall / revised_scene_management.py
Created September 26, 2016 16:49
revised_scene_management.py
# for use with https://github.com/omz/PythonistaAppTemplate
from scene import *
import ui
import time
class FirstScene(Scene):
def setup(self):
# get starting time
@Mr-Coxall
Mr-Coxall / too_many_students_b.py
Created October 1, 2016 11:44
too_many_students_b.py
# Created by: Mr. Coxall
# Created on: Sep 2016
# Created for: ICS3U
# This program shows how to use an if statement
import ui
MAX_NUMBER_OF_STUDENTS = 24
def check_number_of_students_touch_up_inside(sender):
@Mr-Coxall
Mr-Coxall / guessing_game.py
Created October 1, 2016 12:16
guessing_game.py
# Created by: Mr. Coxall
# Created on: Sep 2016
# Created for: ICS3U
# This program shows how to use an if statement
import ui
from numpy import random
# random number to guess
number_to_guess = random.randint(1, 10)
@Mr-Coxall
Mr-Coxall / area_and_perimeter_ver3.py
Created October 24, 2016 02:22
area_and_perimeter_ver3.py
# Created by: Mr. Coxall
# Created on: Aug 2016
# Created for: ICS3U
# This program displays area and perimeter of a rectangle,
# but this time the user can enter different lengths and widths
import ui
def calculate_area(length_sent, width_sent):
# calculate area
@Mr-Coxall
Mr-Coxall / full_name.py
Created October 31, 2016 04:42
full_name.py
# Created by: Mr. Coxall
# Created on: Aug 2016
# Created for: ICS3U
# This program shows optional and named parameters
def print_name(first, initial = '', last = ''):
# print name
if initial == '':
print(first + ' ' + last)
else:
@Mr-Coxall
Mr-Coxall / File Picker.py
Created November 24, 2016 01:04 — forked from omz/File Picker.py
File Picker.py
# coding: utf-8
import ui
import os
from objc_util import ObjCInstance, ObjCClass
from operator import attrgetter
import time
import threading
import functools
import ftplib
import re