"""
This module implements python classes which inherit from
and extend the functionality of the ROOT canvas classes.
"""

import ctypes, ctypes.util
ctypes.cdll.LoadLibrary(ctypes.util.find_library("Gui"))

import ROOT

from ..core import Object
from .. import rootpy_globals as _globals
from .. import defaults, QROOT


class _PadBase(Object):

    def _post_init(self):

        self.members = []
        _globals.pad = self

    def Clear(self, *args, **kwargs):

        self.members = []
        self.ROOT_base.Clear(self, *args, **kwargs)

    def OwnMembers(self):

        for thing in self.GetListOfPrimitives():
            if thing not in self.members:
                self.members.append(thing)

    def cd(self, *args):

        _globals.pad = self
        return self.ROOT_base.cd(self, *args)

class Pad(_PadBase, QROOT.TPad):

    def __init__(self, *args, **kwargs):

        ROOT.TPad.__init__(self, *args, **kwargs)
        self._post_init()

class Canvas(_PadBase, QROOT.TCanvas):

    def __init__(self,
                 width=defaults.CANVAS_WIDTH,
                 height=defaults.CANVAS_HEIGHT,
                 xpos=0, ypos=0, name=None, title=None):

        Object.__init__(self, name, title, xpos, ypos, width, height)
        self._post_init()

@@ -120,93 +120,8 @@
 %22%22%0A%0A
-import ctypes, ctypes.util%0Actypes.cdll.LoadLibrary(ctypes.util.find_library(%22Gui%22))%0A%0A
 impo

Remove code which should never have made it in