thanicon.py :  » Business-Application » ThanCad » thancad-0.0.9 » p_gtkwid » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Business Application » ThanCad 
ThanCad » thancad 0.0.9 » p_gtkwid » thanicon.py
import sys, Tkinter

__icons = None
__tk = "An improbable value for Tk :)"
self = sys.modules[__name__]

def get(name):
    """Return a PhotoImage object named name.

    The image is created calling the local function function name().
    The created image is cached  __icons, so that a hard
    reference to the image always exists in order to keep it alive.
    If the same image is asked again, a reference to the created image
    is returned and thus we save memory.
    If Tkinter library is initialised, then destroyed and then reinitialised,
    the images are ivalidated and produce error if you try to display
    them. Thus get() checks for Tk reinitialisation and deletes the
    cached images.
    """
    global __icons, __tk
    if __tk != Tkinter._default_root:
        if __icons != None: print "Module", __name__, ": Reinitialise images"
        __icons = {}
        __tk = Tkinter._default_root

    try: return __icons[name]
    except: pass
    fun = getattr(self, name)
    ph = Tkinter.PhotoImage(data=fun())
    __icons[name] = ph
    return ph
    
def cancel(): return '\
    R0lGODlhEAAQAPECAAAAAK+0n////wAAACH5BAEBAAIALAAAAAAQABAAAAKRlChRokSJEiVKFAhR\
    okSJEgVClAhQokSJEgFKlCgQokSJAiFKlCgRoESJACVKlChRIESBECVKlChRIkCAEiVKlChRokCI\
    EiVKlChRIkCAEiVKlChRIESBECVKlCgRoESJACVKlCgQokSJAiFKlAhQokSJEgFKFAhRokSJEgVC\
    lChRokSJEiVKlChRokSJEiVKBQA7'

def clear(): return '\
    R0lGODlhEAAQAKIAANnZ2QAAAP//AICAAMDAwP///////////yH5BAEAAAAALAAAAAAQABAAAANm\
    CLrciqHLCwgQAIEAoaEYABCAEAABCAEQgAAYuryAAAEQCBCqqgAFQAAgAIYqAGAEgmqgqAYABoJq\
    oKhGIOhCoKjGBIJuoKjGDAaCaiCpxgwGgm4gqcYEgi4EkmoEgu5i6CLocjsmADs='

def help(): return '\
    R0lGODlhEAAQAJEAANnZ2QAAAP//AP///yH5BAEAAAAALAAAAAAQABAAAAJIhI+pEEEJ4WOEiJAS\
    gg9B8i0IfohEBMkh+BBxIaQQPlqIBMFHCJEg+AghEgQfIUSC4KNFRBB8TN0ISggfLUSC4KNFRBB8\
    TIUCADs='

def move(): return '\
    R0lGODlhEAAQAPECAAAAAK+0n////wAAACH5BAEBAAIALAAAAAAQABAAAAKRlChRokSJEiVKlChR\
    okCIEiVKlChRIkCAEiVKlChRIECAECVKlChRokCIEiVKlChQokCIEiFKlAhQokCIEgFKFAgQIECA\
    AAFCFAgQIECAAAFClAhQokCIEgFKlChQokCIEiFKlChRokCIEiVKlChRIECAECVKlChRIkCAEiVK\
    lChRokCIEiVKlChRokSJEiVKBQA7'

def new(): return '\
    R0lGODlhEAAQAJEAANnZ2QAAAP///////yH5BAEAAAAALAAAAAAQABAAAAJJhI+JFD8I/gXJjiD4\
    FiQ7JAg+BMmOiCD4QfItCH6QfAuCHyTfguAHybcg+EHyLQh+kHwLgh8k34LgB8m3IPhB8i0IPsVH\
    go+JBQA7'

def open(): return '\
    R0lGODlhEAAQAJEAANnZ2QAAAP//AICAACH5BAEAAAAALAAAAAAQABAAAAJNhI+pGEEhfLS4AArh\
    I0ZcUEL4EBEWJDM+wQ+Sb0Hwg+RbEPwg+RYEP0REKP4BhAgpnG8BEEIK51sAQJCyiZgZWgAAETTf\
    gmBTfCT4mFoAOw=='

def regen(): return '\
    R0lGODlhEAAQAPEDAACAAP8AAK+0n////yH5BAEBAAMALAAAAAAQABAAAAKR3Lhx48aNGzdu3Lhx\
    48aNAzdu3Lhx48aNAzFuHAgQIECAAAFuHAgQIECAAAFu3Lhx48aNAzFu3Lhx48aNAzdu3Lhx48aN\
    Gzdu3Lhx48aNGzdu3Lgx48aNGzdu3Lgw48aNGzdu3JgwYcKECRNm3JgwYcKECRNm3Lgw48aNGzdu\
    3Lgx48aNGzdu3Lhx48aNGzduBQA7'

def run(): return '\
    R0lGODlhEAAQAPIFAAAAAFhYWAAAgP8AAK+0n////wAAAAAAACH5BAEBAAUALAAAAAAQABAAAAOW\
    WFVVhVVVVVhVVYVVUlU4VVWCVSUiKFI1hVUlVVhVJYU1U1VYUlWFVVUACFAlglJVVVhQVYVQJVVY\
    VQWFUAUFWFVVgzNQFRhVMIVVVTUIVRGFBTNTWFUFhVAFBVhVVYVSBVVYBVWFVSUiWAUAgFVVVVgl\
    VYU1UyVYVVWFUlU1WCUiglJVUlhVU4UlVVVYVVWFVVVVWFWVADs='

def save(): return '\
    R0lGODlhEAAQAJEAANnZ2QAAAICAgMDAwCH5BAEAAAAALAAAAAAQABAAAAJZhI9pFB8RIITC+RYQ\
    ABSF5ltEAFAUmm8hAUBRaL6FBABFofkWEgAUheZbSABQJIpvIgFAoXy0AAiSGP8kAIIkxgcICSBE\
    QvEBQgIIkVB8gJAAAhgfj+BjWgEAOw=='

def saveas(): return '\
    R0lGODlhEAAQAKIAANnZ2QAAAICAgMDAwP//AICAAP///////yH5BAEAAAAALAAAAAAQABAAAANt\
    CLrciqHLDAghgaOrARgAIYGjqxEYACGBo6shGAAhgaOrIRgAIYGjqyEYACGBMxGqGBIAgSIRRBiq\
    EoAQIhJIqiGCARAiGEFEqgoBhEhgEAWWagBgiEQQBpZqBCCESAQGlmpIICiGLi+CLrdiAgA7'

def zoomall(): return '\
    R0lGODlhEAAQAPEDAAAAAP//AK+0n////yH5BAEBAAMALAAAAAAQABAAAAKR3Lhx48aNGzdu3Lhx\
    YcKEGTdu3LgxYcKECTdu3LgwYcKECTNu3JgQIMKAABNuXJgQYMKEABNmXJgQIcKAARNmXJgwYUCE\
    CRNmXJgwYUCECRNmXJgQIcKAARNmXJgQYMKEABNm3JgQIMKAABNu3LgwYcKECTNu3LgxYcKECTdu\
    3LhxYcKEGTdu3Lhx48aNGzduBQA7'

def zoomin(): return '\
    R0lGODlhEAAQAPEDAAAAAP//AK+0n////yH5BAEBAAMALAAAAAAQABAAAAKR3Lhx48aNGzdu3Lhx\
    YcKEGTdu3LgxYcKECTdu3LgwYUCECTNu3JgwYUCECRNuXJgwYUCECRNmXJgwYUCECRNmXBgQIECA\
    ABFmXBgQIECAABFmXJgwYUCECRNmXJgwYUCECRNm3JgwYUCECRNu3LgwYUCECTNu3LgxYcKECTdu\
    3LhxYcKEGTdu3Lhx48aNGzduBQA7'

def zoomout(): return '\
    R0lGODlhEAAQAPEDAAAAAP//AK+0n////yH5BAEBAAMALAAAAAAQABAAAAKR3Lhx48aNGzdu3Lhx\
    YcKEGTdu3LgxYcKECTdu3LgwYcKECTNu3JgwYcKECRNuXJgwYcKECRNmXJgwYcKECRNmXBgQIECA\
    ABFmXBgQIECAABFmXJgwYcKECRNmXJgwYcKECRNm3JgwYcKECRNu3LgwYcKECTNu3LgxYcKECTdu\
    3LhxYcKEGTdu3Lhx48aNGzduBQA7'

if __name__ == "__main__":
    root = Tkinter.Tk()
    ph = get("cancel")
    b = Tkinter.Button(root, image=ph)
    b.grid()
    root.mainloop()
    root = Tkinter.Tk()
    ph = get("cancel")
    b = Tkinter.Button(root, image=ph)
    b.grid()
    root.mainloop()
    
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.