Пример #1
0
 def __init__(self, **kwds):
     Window.__init__(self, **kwds)
     self.view = TestScrollableView(container=self,
                                    x=20,
                                    y=20,
                                    width=300,
                                    height=300)  #, scrolling = 'hv')
     self.view.report_update_rect = True
     if 1:  ###
         self.h_scrolling_ctrl = CheckBox("Horizontal Scrolling",
                                          value='h' in self.view.scrolling,
                                          action='horz_scrolling')
         self.v_scrolling_ctrl = CheckBox("Vertical Scrolling",
                                          value='v' in self.view.scrolling,
                                          action='vert_scrolling')
         self.border_ctrl = CheckBox("Border",
                                     value=1,
                                     action='change_border')
         CheckBox("Vertical Scrolling", value=1, action='vert_scrolling'),
         buttons = self.create_buttons()
         x = self.view.right + 5
         y = self.view.top
         for b in buttons:
             b.position = (x, y)
             self.add(b)
             y = b.bottom + 5
         #self.shrink_wrap()
         self.view.become_target()
Пример #2
0
def test():
    cursor = StdCursors.finger
    win = Window(title = "Cursor", width = 500, height = 400)
    view1 = TestDrawing(position = (20, 20), size = (100, 70), cursor = cursor)
    view2 = TestScrollableView(position = (140, 20), size = (200, 200),
        scrolling = 'hv')
    view2.cursor = cursor
    win.add(view1)
    win.place(view2, sticky = 'nsew')
    win.shrink_wrap((20, 20))
    win.show()
Пример #3
0
def test():
    cursor = StdCursors.finger
    win = Window(title="Cursor", width=500, height=400)
    view1 = TestDrawing(position=(20, 20), size=(100, 70), cursor=cursor)
    view2 = TestScrollableView(position=(140, 20),
                               size=(200, 200),
                               scrolling='hv')
    view2.cursor = cursor
    win.add(view1)
    win.place(view2, sticky='nsew')
    win.shrink_wrap((20, 20))
    win.show()
Пример #4
0
def test():
    file = "grail_masked.tiff"
    # file = "spam_masked.tiff"
    image = Image(os.path.join(sys.path[0], file))
    cursor = Cursor(image)
    win = Window(title="Image Cursor", width=500, height=400)
    view1 = TestDrawing(position=(20, 20), size=(100, 70), cursor=cursor)
    view2 = TestScrollableView(position=(140, 20), size=(200, 200), scrolling="hv")
    view2.cursor = cursor
    win.add(view1)
    win.place(view2, sticky="nsew")
    win.shrink_wrap((20, 20))
    win.show()
 def __init__(self, **kwds):
     Window.__init__(self, **kwds)
     view = TestScrollableView(container = self,
         size = (300, 300),
         extent = (1000, 1000),
         scrolling = 'hv',
         anchor = 'ltrb')
     button = Button("Embedded", action = self.click)
     off = (300, 300)
     view.scroll_offset = off
     button.position = off
     view.add(button)
     self.shrink_wrap()
Пример #6
0
 def __init__(self, **kwds):
     Window.__init__(self, **kwds)
     view = TestScrollableView(container=self,
                               size=(300, 300),
                               extent=(1000, 1000),
                               scrolling='hv',
                               anchor='ltrb')
     button = Button("Embedded", action=self.click)
     off = (300, 300)
     view.scroll_offset = off
     button.position = off
     view.add(button)
     self.shrink_wrap()
Пример #7
0
def test():
	file = "grail_masked.tiff"
	#file = "spam_masked.tiff"
	image = Image(os.path.join(sys.path[0], file))
	cursor = Cursor(image)
	win = Window(title = "Image Cursor", width = 500, height = 400)
	view1 = TestDrawing(position = (20, 20), size = (100, 70), cursor = cursor)
	view2 = TestScrollableView(position = (140, 20), size = (200, 200),
		scrolling = 'hv')
	view2.cursor = cursor
	win.add(view1)
	win.place(view2, sticky = 'nsew')
	win.shrink_wrap((20, 20))
	win.show()
Пример #8
0
class TestWindow(Window):
    def __init__(self, **kwds):
        Window.__init__(self, **kwds)
        self.view = TestScrollableView(container=self,
                                       x=20,
                                       y=20,
                                       width=300,
                                       height=300)  #, scrolling = 'hv')
        self.view.report_update_rect = True
        if 1:  ###
            self.h_scrolling_ctrl = CheckBox("Horizontal Scrolling",
                                             value='h' in self.view.scrolling,
                                             action='horz_scrolling')
            self.v_scrolling_ctrl = CheckBox("Vertical Scrolling",
                                             value='v' in self.view.scrolling,
                                             action='vert_scrolling')
            self.border_ctrl = CheckBox("Border",
                                        value=1,
                                        action='change_border')
            CheckBox("Vertical Scrolling", value=1, action='vert_scrolling'),
            buttons = self.create_buttons()
            x = self.view.right + 5
            y = self.view.top
            for b in buttons:
                b.position = (x, y)
                self.add(b)
                y = b.bottom + 5
            #self.shrink_wrap()
            self.view.become_target()

    def create_buttons(self):
        return [
            Button("Scroll Left", action=('scroll', -16, 0)),
            Button("Scroll Right", action=('scroll', 16, 0)),
            Button("Scroll Up", action=('scroll', 0, -16)),
            Button("Scroll Down", action=('scroll', 0, 16)),
            Button("Small Extent", action=('extent', 100, 100)),
            Button("Medium Extent", action=('extent', 500, 500)),
            Button("Large Extent", action=('extent', 1000, 1000)),
            self.h_scrolling_ctrl,
            self.v_scrolling_ctrl,
            self.border_ctrl,
        ]

    def scroll(self, dx, dy):
        self.view.scroll_by(dx, dy)

    def extent(self, w, h):
        self.view.extent = (w, h)
        self.view.invalidate()
        say("Extent =", self.view.extent)

    def horz_scrolling(self):
        self.view.hscrolling = self.h_scrolling_ctrl.value

    def vert_scrolling(self):
        self.view.vscrolling = self.v_scrolling_ctrl.value

    def change_border(self):
        self.view.border = self.border_ctrl.value
Пример #9
0
class TestWindow(Window):

    def __init__(self, **kwds):
        Window.__init__(self, **kwds)
        self.view = TestScrollableView(container = self,
            x = 20, y = 20,
            width = 300, height = 300)#, scrolling = 'hv')
        self.view.report_update_rect = True
        if 1: ###
            self.h_scrolling_ctrl = CheckBox("Horizontal Scrolling",
                value = 'h' in self.view.scrolling, 
                action = 'horz_scrolling')
            self.v_scrolling_ctrl = CheckBox("Vertical Scrolling",
                value = 'v' in self.view.scrolling,
                action = 'vert_scrolling')
            self.border_ctrl = CheckBox("Border", value = 1, action = 'change_border')
            CheckBox("Vertical Scrolling", value = 1, action = 'vert_scrolling'),
            buttons = self.create_buttons()
            x = self.view.right + 5
            y = self.view.top
            for b in buttons:
                b.position = (x, y)
                self.add(b)
                y = b.bottom + 5
            #self.shrink_wrap()
            self.view.become_target()
    
    def create_buttons(self):
        return [
            Button("Scroll Left", action = ('scroll', -16, 0)),
            Button("Scroll Right", action = ('scroll', 16, 0)),
            Button("Scroll Up", action = ('scroll', 0, -16)),
            Button("Scroll Down", action = ('scroll', 0, 16)),
            Button("Small Extent", action = ('extent', 100, 100)),
            Button("Medium Extent", action = ('extent', 500, 500)),
            Button("Large Extent", action = ('extent', 1000, 1000)),
            self.h_scrolling_ctrl,
            self.v_scrolling_ctrl,
            self.border_ctrl,
        ]
    
    def scroll(self, dx, dy):
        self.view.scroll_by(dx, dy)
    
    def extent(self, w, h):
        self.view.extent = (w, h)
        self.view.invalidate()
        say("Extent =", self.view.extent)
    
    def horz_scrolling(self):
        self.view.hscrolling = self.h_scrolling_ctrl.value

    def vert_scrolling(self):
        self.view.vscrolling = self.v_scrolling_ctrl.value
    
    def change_border(self):
        self.view.border = self.border_ctrl.value
Пример #10
0
 def __init__(self, **kwds):
     Window.__init__(self, **kwds)
     self.view = TestScrollableView(container = self,
         x = 20, y = 20,
         width = 300, height = 300)#, scrolling = 'hv')
     self.view.report_update_rect = True
     if 1: ###
         self.h_scrolling_ctrl = CheckBox("Horizontal Scrolling",
             value = 'h' in self.view.scrolling, 
             action = 'horz_scrolling')
         self.v_scrolling_ctrl = CheckBox("Vertical Scrolling",
             value = 'v' in self.view.scrolling,
             action = 'vert_scrolling')
         self.border_ctrl = CheckBox("Border", value = 1, action = 'change_border')
         CheckBox("Vertical Scrolling", value = 1, action = 'vert_scrolling'),
         buttons = self.create_buttons()
         x = self.view.right + 5
         y = self.view.top
         for b in buttons:
             b.position = (x, y)
             self.add(b)
             y = b.bottom + 5
         #self.shrink_wrap()
         self.view.become_target()