

import Tkinter , ImageTk


from ..mixin.mixin import mixin
from .image import structure_to_image
from .layer import DEFAULT_DISPLAY_LAYER_SET

__all__ = []

class show_tk_structure_mixin(object):
    
    def show(self, bitmap_size = None, box = None, display_styles = DEFAULT_DISPLAY_LAYER_SET):
        if bitmap_size == None: bitmap_size = (800, 600)
        win = Tkinter.Tk()
        img = structure_to_image(self, bitmap_size, box, display_styles)
        win.geometry('%dx%d' % (img.size[0], img.size[1]))
        tkpi = ImageTk.PhotoImage(img)
        label_image = Tkinter.Label(win, image=tkpi)
        label_image.place(x=0,y=0,width=img.size[0],height=img.size[1])
        win.title(self.name)
        win.mainloop()

from ..primitives.structure import gds_structure
gds_structure.mixin(show_tk_structure_mixin)