Skip to content

Instantly share code, notes, and snippets.

from Tkinter import *
from PIL import Image, ImageTk
class Banana(object):
def __init__(self, root):
self.img = self.dimg = Image.open("im_a_banana.jpg")
self.dimensions = self.dd = self.img.size
self.root = root
self.l = Label(self.root)
self.redraw_image()

@title: Learn Tkinter Progressively @author: basicxman @tags: learning progressively tkinter python tutorial

What is Tkinter?

  • A binding for using the Tk graphics framework in Python.
  • A library which has lots of old, large, and verbose documentation
    • Not so helpful to beginners.
import glob
import string
import colorsys
import sys
from Tkinter import *
class Constellations(object):
def __init__(self):
self.named_stars = []
self.constellations = {}
from Tkinter import *
import random
def animation_threshold():
global i
if i == 50000:
i = 0
return False
else:
i += 1
--someboolean
--someoption "Foo bar baz."
--someotheroption "bar."
unless Object.const_defined? 'Minecraft'
$:.unshift File.expand_path("../../lib", __FILE__)
require "minecraft"
end
require "minitest/autorun"
require "fileutils"
require "open3"
class Test < MiniTest::Unit::TestCase
#!/usr/bin/env python
def check(s):
if isinstance(s, int) or isinstance(s, float): return s
exit()
def pluralize(currency, amount):
if amount == 1: return currency
if currency == "penny":
return "pennies"
#!/usr/bin/env python
import re
import string
def process_string_re(line):
"""Removes alphanumeric characters using regular expressions."""
return re.sub(r'[a-z0-9]', '', line)
def process_string(line):
def resolve_key(key)
bucket = key[0]
return key if @item_buckets[bucket].include? key
shortest_diff = nil
shortest_key = nil
@item_buckets[bucket].each do |test_key|
if test_key.length > key.length
diff = test_key.length - key.length if test_key.index(key)
else
@basicxman
basicxman / commander.rb
Created August 13, 2011 01:24
Minecraft server wrapper.
require 'data_values'
class Commander
KIT = {
:diamond => [276, 277, 278, 279, 293],
:armour => [310, 311, 312, 313],
:ranged => [261, [262, 640]]
}
def process(line)