Ejemplo n.º 1
0
    def saveReducedSimulation(self):
        format = self.result.Format_CB.get()
        self.work_folder = filedialog.askdirectory(initialdir="/HOME",
                                                   title="Select folder")
        savename = self.work_folder + "/" + basename(
            filename
        ) + "_reduced_model_simulation." + self.result.Format_CB.get()

        if self.result.Format_CB.get() == "png":
            SimuToSave = ImageTk.getimage(resultsimureduced)
            SimuToSave.save(savename)

        elif self.result.Format_CB.get() == "pdf":
            SimuToSave = ImageTk.getimage(resultsimureduced)
            SimuToSave = SimuToSave.convert('RGB')
            SimuToSave.save(savename)

        else:
            showwarning(message='Please select a correct format', )
Ejemplo n.º 2
0
def test_photoimage_blank():
    # test a image using mode/size:
    for mode in TK_MODES:
        im_tk = ImageTk.PhotoImage(mode, (100, 100))

        assert im_tk.width() == 100
        assert im_tk.height() == 100

        im = Image.new(mode, (100, 100))
        reloaded = ImageTk.getimage(im_tk)
        assert_image_equal(reloaded.convert(mode), im)
Ejemplo n.º 3
0
    def saveInitSimulation(self):
        format = self.resultInit.Format_CB.get()
        self.work_folder = filedialog.askdirectory(initialdir="/HOME",
                                                   title="Select folder")
        savename = self.work_folder + "/" + basename(
            filename
        ) + "_input_model_simulation." + self.resultInit.Format_CB.get()

        if self.resultInit.Format_CB.get() == "png":
            SimuToSave = ImageTk.getimage(resultsimu)

            SimuToSave.save(savename)
            #simulatepy(filename, self.resultInit.Entry_number.get(),meth)

        elif self.resultInit.Format_CB.get() == "pdf":
            SimuToSave = ImageTk.getimage(resultsimu)
            SimuToSave = SimuToSave.convert('RGB')
            SimuToSave.save(savename)

        else:
            showwarning(message='Please select a correct format', )
Ejemplo n.º 4
0
    def test_photoimage(self):
        for mode in TK_MODES:
            # test as image:
            im = hopper(mode)

            # this should not crash
            im_tk = ImageTk.PhotoImage(im)

            self.assertEqual(im_tk.width(), im.width)
            self.assertEqual(im_tk.height(), im.height)

            reloaded = ImageTk.getimage(im_tk)
            self.assert_image_equal(reloaded, im.convert("RGBA"))
Ejemplo n.º 5
0
    def test_photoimage(self):
        for mode in TK_MODES:
            # test as image:
            im = hopper(mode)

            # this should not crash
            im_tk = ImageTk.PhotoImage(im)

            self.assertEqual(im_tk.width(), im.width)
            self.assertEqual(im_tk.height(), im.height)

            reloaded = ImageTk.getimage(im_tk)
            self.assert_image_equal(reloaded, im.convert("RGBA"))