Esempio n. 1
0
    def setUp(self):
        self.master = Tk()

        var = TextAlphaNumRO(name='textalphanum')

        self.button1 = TkButton(self.master, var, text="NW")
        self.button1.grid(row=0, column=0)
        self.button2 = TkButton(self.master, var, text="SW")
        self.button2.grid(row=0, column=1)
        self.button4 = TkButton(self.master, var, text="NE")
        self.button4.grid(row=1, columnspan=3, sticky=NSEW)
Esempio n. 2
0
    def test_label(self):

        textro = TextAlphaNumRO(name="")

        widget = tkwidgetfactory(self.master,
                                 textro,
                                 self.master,
                                 self.master,
                                 text='foobar')
        widget.pack(fill=BOTH, expand=1)
        #self.master.mainloop()
        self.assertIsInstance(widget, TkLabel)
Esempio n. 3
0
    def setUp(self):
        self.master = Tk()
        self.master.geometry(geometry_get(**defaultmaster))

        var = TextAlphaNumRO(name='textalphanum')

        self.button1 = TkButton(self.master, var, text="NW")
        self.button1.grid(row=0, column=0, sticky=NSEW)
        self.button2 = TkButton(self.master, var, text="SW")
        self.button2.grid(row=0, column=1, sticky=NSEW)
        self.button4 = TkButton(self.master, var, text="NE")
        self.button4.grid(row=1, columnspan=3, sticky=NSEW)

        self.master.columnconfigure(0, weight=1, uniform='foobar')
        self.master.columnconfigure(1, weight=1, uniform='foobar')
        self.master.rowconfigure(0, weight=1, uniform='foobar')
        self.master.rowconfigure(1, weight=1, uniform='foobar')
Esempio n. 4
0
    def setUp(self):
        self.master = Tk()

        self.geom = geometry_get(300, 300, 0, 0)
        self.master.geometry(self.geom)

        self.maxrows = 7  # rows in the grid
        self.maxcols = 5  # cols in the grid
        #self.maxwidgets=self.maxrows*self.maxcols
        self.wmheight = 500  # master height
        self.wmwidth = 500  # master width

        image_args = dict(pointsize=16,
                          font='Helvetica',
                          gravity='center',
                          rotate=0,
                          label='foobar')
        gridcfg = nxnarraycreate(self.maxrows, self.maxcols, image_args)

        widget_args = dict(background='black', text='foo')
        widgetcfg = nxnarraycreate(self.maxrows, self.maxcols, widget_args)

        rowcfg = dict(height=2, fg='yellow', text="x")
        colcfg = dict(width=2, fg='yellow', text="y")

        self.mytextalphanumro = TextAlphaNumRO(name='textalphanum')

        self.tkilg = TkImageLabelGrid(self.master, 'grid',
                                      self.mytextalphanumro, self.wmwidth,
                                      self.wmheight, 0, 0, self.maxrows,
                                      self.maxcols, True, False, gridcfg,
                                      widgetcfg, 1, 1, rowcfg, colcfg)

        self.tkilg.grid(row=0, column=0, sticky=NSEW)

        self.tkilg.cell_set(0, 0, **dict(background='yellow',
                                         width=2,
                                         height=2))
        self.tkilg.cell_set(1, 1, **dict(background='pink', width=2, height=2))

        self.master.grid_rowconfigure(0, weight=1, uniform="foo")
        self.master.grid_columnconfigure(0, weight=1, uniform="foo")

        self.tkilg.image_set()
Esempio n. 5
0
    def test_label(self):

        label = 'foobar'

        self.mytextalphanumro = TextAlphaNumRO(name='textalphanum')

        self.lbl = tkwidgetfactory(self.master, self.mytextalphanumro,
                                   self.master, self.master)
        self.lbl.pack(fill=BOTH, expand=1)

        tkwidgetimage_set(self.ic, self.lbl, label, True, **self.image_args)

        exp_res = get_gif_filename(
            '/Users/burtnolej/Development/pythonapps3/clean/utils/test_gifs',
            label, self.lbl.image_args)

        #self.assertFilesEqual(exp_res,self.lbl.image)

        self.assertTrue(isinstance(self.lbl, TkLabel))
Esempio n. 6
0
    def setUp(self):
        self.master = Tk()
        self.width = 1200
        self.height = 1300
        self.x = 100
        self.y = 100
        self.geom = geometry_get(self.height, self.width, self.x, self.y)
        self.master.geometry(self.geom)

        self.frame = Frame(self.master)
        self.frame.place(width=200, height=200, x=100, y=100)
        self.frame.config()

        self.idle = False

        self.master.grid_columnconfigure(0, weight=1, uniform="foo")
        self.master.grid_rowconfigure(0, weight=1, uniform="foo2")

        self.frame.grid_columnconfigure(0, weight=1, uniform="foo")
        self.frame.grid_rowconfigure(0, weight=1, uniform="foo2")

        labelstr = TextAlphaNumRO(name="")

        self.lbl = TkImageWidget(self.frame, labelstr)
        self.lbl.grid(row=0, column=0, sticky=NSEW)

        self.image_args = dict(pointsize=24,
                               font='Helvetica',
                               gravity='center',
                               rotate=90)

        self.draw()

        def d(event):
            if self.idle == False:
                self.master.after(1000, self.draw)
                self.idle = True

        self.master.bind('<Configure>', d)
Esempio n. 7
0
            def __init__(self):
                Tk.__init__(self)

                self.maxrows = 13  # rows in the grid
                self.maxcols = 13  # cols in the grid
                self.wmheight = 1300  # master height
                self.wmwidth = 1200  # master width

                custommaster = dict(height=self.wmheight,
                                    width=self.wmwidth,
                                    x=0,
                                    y=0)

                self.geometry(geometry_get(**custommaster))

                image_args = dict(pointsize=24,
                                  font='Helvetica',
                                  gravity='center',
                                  rotate=0,
                                  label='foobar')

                gridcfg = nxnarraycreate(self.maxrows, self.maxcols,
                                         image_args)

                widget_args = {'background': 'white'}
                widgetcfg = nxnarraycreate(self.maxrows, self.maxcols,
                                           widget_args)

                self.mytextalphanumro = TextAlphaNumRO(name='textalphanum')

                self.tkilg = TkImageLabelGrid(self.master, 'grid',
                                              self.mytextalphanumro,
                                              self.wmwidth, self.wmheight, 0,
                                              0, self.maxrows, self.maxcols,
                                              True, True, gridcfg, widgetcfg)

                self.tkilg.grid(row=0, column=0, sticky=NSEW)
                self.grid_rowconfigure(0, weight=1, uniform="foo")
                self.grid_columnconfigure(0, weight=1, uniform="foo")