Пример #1
0
def editor(): 
    """Run editor"""
    global zone_dessin     
    global grid 
    global entry_retour
    global combobox_difficulty
    global lvlList
    
    grid = Grid()
    
    # Windows
    fenetre = Tk()

    fenetre.geometry("500x525")
    fenetre.title("Editeur Hanjie")
    fenetre.resizable(width=False, height=False)

    # Canvas
    zone_dessin = Canvas(fenetre,width=500,height=500, bg="white")
    zone_dessin.place(x=0,y=0) 
    Initialisation()
    zone_dessin.bind("<Button-1>", Swap)

    # Entry
    default_text = StringVar()
    entry_retour = Entry(fenetre,width=20,textvariable=default_text)
    default_text.set("Level name...")
    entry_retour.place(x=2,y=503)

    # Save Button
    button_save = Button(fenetre,text="Save", width=8,height=1, command = But_Save)
    button_save.place(x=130,y=500)

    # Load Button
    button_load = Button(fenetre,text="Load", width=8,height=1, command = But_Load)
    button_load.place(x=200,y=500)

    # Reset Button
    button_load = Button(fenetre,text="Reset", width=8,height=1, command = But_Reset)
    button_load.place(x=270,y=500)

    # Difficulty Combobox
    lvlSelect = StringVar()
    lvlList = ('LVL 1', 'LVL 2', 'LVL 3', 'LVL 4', 'LVL 5')
    combobox_difficulty = Combobox(fenetre, values = lvlList, state = 'readonly')    
    combobox_difficulty.set(lvlList[0])
    combobox_difficulty.place(x=340,y=502)

    fenetre.mainloop()
Пример #2
0
class Frame1(Frame):
  
    def __init__(self, parent):
        Frame.__init__(self, parent, background="white")   
        
        self.parent = parent
        
        self.initUI()
        
    def initUI(self):
        
        self.lbox = Listbox(self, height = 10, width = 55)
        sbar = Scrollbar(self, command=self.lbox.yview)
        sbar.place(x=360, y=240)
        self.lbox.config(yscrollcommand=sbar.set)
        self.lbox.place(x=10, y=240)

        self.lbox.insert('end',  "Interface Básica de Controle dos Motores - v1.0")
        self.lbox.insert('end', "S.O. (%s)"  % (sys.platform))
      
        self.parent.title("Interface básica para controle dos motores - v1.0")
        self.pack(fill=BOTH, expand=1)

        self.opts = ""
        self.cbox = Combobox(self, textvariable=self.opts, state='readonly')
        for n,s in scan():
            self.opts += "%s " % (s)
              
        self.cbox['values'] = self.opts
        if(self.opts != ""):
            self.cbox.current(0)
        self.cbox.place(x=10, y=10)
        "self.cbox.bind('<<ComboboxSelected>>', self.conectar)"

        btConectar = Button(self, text="Conectar", width=10)
        btConectar.bind("<Button-1>", self.conectar)
        btConectar.place(x=200, y=10)
        
        btFrente = Button(self, text="/\\", width=5)
        btFrente.bind("<Button-1>", self.comandoF)
        btFrente.place(x=160, y=100)
        btTraz = Button(self, text="\/", width=5)
        btTraz.bind("<Button-1>", self.comandoT)
        btTraz.place(x=160, y=130)

        btEsqFrente = Button(self, text="/\\", width=5)
        btEsqFrente.place(x=50, y=70)
        btEsqFrente.bind("<Button-1>", self.comandoEF)
        btEsqTraz = Button(self, text="\/", width=5)
        btEsqTraz.place(x=50, y=150)
        btEsqTraz.bind("<Button-1>", self.comandoET)

        btDirFrente = Button(self, text="/\\", width=5)
        btDirFrente.place(x=260, y=70)
        btDirFrente.bind("<Button-1>", self.comandoDF)
        btDirTraz = Button(self, text="\/", width=5)
        btDirTraz.place(x=260, y=150)
        btDirTraz.bind("<Button-1>", self.comandoDT)

        btGiraEsq = Button(self, text=">>", width=5)
        btGiraEsq.place(x=90, y=200)
        btGiraEsq.bind("<Button-1>", self.comandoGE)
        btParar = Button(self, text="-x-", width=5)
        btParar.place(x=160, y=200)
        btParar.bind("<Button-1>", self.comandoP)
        btGiraDir = Button(self, text="<<", width=5)
        btGiraDir.place(x=230, y=200)
        btGiraDir.bind("<Button-1>", self.comandoGD)  
        

    def conectar(self, event):
        self.lbox.insert('end', "conectando...")
        self.lbox.insert('end', "Porta:", self.cbox.get())
        self.lbox.insert('end', "Baund: 9600")

        self.arduino = None   

        try:
            self.arduino = serial.Serial(self.cbox.get(), 9600);
            self.lbox.insert('end', "Conectado! \n")
        
            try:
               self.lbox.insert('end', self.arduino.readline() )
               self.lbox.insert('end', self.arduino.readline())
               self.lbox.insert('end', self.arduino.readline())
               self.lbox.insert('end', self.arduino.readline())
                   
            except serial.serialutil.SerialException:
               pass
        except:
            pass
        finally:
            if self.arduino:
                "self.arduino.close()"
                pass
            
    def comandoP(self, event):
        self.lbox.insert('0', "Comando 3000")
        try:
            self.arduino.write("3000\n")
            self.lbox.insert('0', self.arduino.readline() )
        except:
            pass
        
    def comandoF(self, event):
        self.lbox.insert('0', "Comando 3300")
        try:
            self.arduino.write("3300\n")
            self.lbox.insert('0', self.arduino.readline() )
        except:
            pass

    def comandoT(self, event):
        self.lbox.insert('0', "Comando 3700")
        try:
            self.arduino.write("3700\n")
            self.lbox.insert('0', self.arduino.readline() )
        except:
            pass

    def comandoEF(self, event):
        self.lbox.insert('0', "Comando 2300")
        try:
            self.arduino.write("2300\n")
            self.lbox.insert('0', self.arduino.readline())
        except:
            pass

    def comandoET(self, event):
        self.lbox.insert('0', "Comando 2700")
        try:
            self.arduino.write("2700\n")
            self.lbox.insert('0',  self.arduino.readline())
        except:
            pass

    def comandoDF(self, event):
        self.lbox.insert('0',  "Comando 1300")
        try:
            self.arduino.write("1300\n")
            self.lbox.insert('0',  self.arduino.readline())
        except:
            pass

    def comandoDT(self, event):
        self.lbox.insert('0',  "Comando 1700")
        try:
            self.arduino.write("1700\n")
            self.lbox.insert('0',  self.arduino.readline())
        except:
            pass

    def comandoGE(self, event):
        self.lbox.insert('0',  "Comando 4300")
        try:
            self.arduino.write("4300\n")
            self.lbox.insert('0',  self.arduino.readline() )
        except:
            pass

    def comandoGD(self, event):
        self.lbox.insert('0',  "Comando 4700")
        try:
            self.arduino.write("4700\n")
            self.lbox.insert('0',  self.arduino.readline() )
        except:
            pass
Пример #3
0
class Application(Frame):
    def __init__(self, master=None):
        Frame.__init__(self, master)
        self.pack(fill=BOTH, expand=1)
        self.initUI()
        self.setGeometry()
        self.component = NewComponent()

    def setGeometry(self):
        x = 300
        y = 100
        self.master.geometry("400x300+%d+%d" % (x, y))
        self.master.update()


    def initUI(self):
        #setup title
        self.master.title("Component Creator")
        self.style = Style()
        self.style.theme_use("clam")

        #indicator label
        self.labelName = Label(self, text="Component Name:")
        self.labelName.place(x=10, y=10)
        self.master.update()

        # create variable and namefield for input of component name
        sv = StringVar()
        sv.trace("w", lambda name, index, mode, sv=sv: self.nameChanged(sv))
        self.nameField = Entry(self, textvariable=sv)
        self.nameField.place(x=10+self.labelName.winfo_width() + 10, y=10)
        self.master.update()

        # label for image name that will show img name for a given component name
        self.imgNameVar = StringVar()
        self.imgNameVar.set('imageName:')
        self.labelImageName = Label(self, textvariable=self.imgNameVar)
        self.labelImageName.place(x=10+self.labelName.winfo_width()+10,y=40)

        # checkbox for visible component or not
        self.cbVar = IntVar()
        self.cb = Checkbutton(self, text="Visible Component",  variable=self.cbVar)
        self.cb.place(x=10, y=70)

        # dropdown list for category
        self.labelCategory = Label(self, text="Category:")
        self.labelCategory.place(x=10, y=110)
        self.master.update()

        acts = ['UserInterface', 'Layout', 'Media', 'Animation', 'Sensors', 'Social', 'Storage',
                'Connectivity', 'LegoMindStorms', 'Experimental', 'Internal', 'Uninitialized']

        self.catBox = Combobox(self, values=acts)
        self.catBox.place(x=10+self.labelCategory.winfo_width()+10, y=110)

        # button to select icon image
        self.getImageButton = Button(self, text="Select icon", command=self.getImage)
        self.getImageButton.place(x=10, y=150)
        self.master.update()

        # explanation for resizing
        self.resizeVar = IntVar()
        self.resizeCB = Checkbutton(self,
            text="ON=Resize Image (Requires PIL)\nOFF=Provide 16x16 Image", variable=self.resizeVar)
        self.resizeCB.place(x=10+self.getImageButton.winfo_width()+10, y=150)

        # create button
        self.createButton = Button(self, text="Create", command=self.create)
        self.createButton.place(x=10, y=230)

        #cancel button
        self.cancelButton = Button(self, text="Cancel", command=self.quit)
        self.cancelButton.place(x=200, y=230)


    # open file picker for selecting an icon
    def getImage(self):
        ftypes = [('All Picture Files', ('*.jpg', '*.png', '*.jpeg', '*.bmp')), ('All files', '*')]
        self.component.imgFile = askopenfilename(filetypes=ftypes, title="Select an Icon file")

    # update component name and image name for component by lowercasing first letter
    def nameChanged(self, sv):
        s = sv.get()
        self.component.compName = s
        self.component.compImgName = s[:1].lower() + s[1:] if s else ''
        self.imgNameVar.set('imageName: %s' % self.component.compImgName)

    # tries to create component
    def create(self):
        # sets parameters for new component based on input values
        self.component.visibleComponent = bool(self.cbVar.get())
        self.component.resizeImage = bool(self.resizeVar.get())
        self.component.category = self.catBox.get().upper()
        self.component.compName = self.nameField.get()

        try:
            # check if component already exists
            try:
                open('../../components/src/com/google/appinentor/components/runtime/%s.java', 'r')
                tkMessageBox.showerror("Duplicate Component","%s already exists" % self.component.compName)
            # if doesnt exist will raise error
            except IOError:
                # check for name input
                if not self.component.compImgName:
                    tkMessageBox.showerror("Missing Name","Please enter component name")
                    return

                #check for category selection
                if not self.component.category:
                    tkMessageBox.showerror("Missing Category","Please select a category")
                    return

                # check if selected an icon
                if not self.component.imgFile:
                    tkMessageBox.showerror("Missing Icon","Please select an icon image")
                    return

                # copy image file to folder, can get error if user checked resize and doest have PIL installed
                try:
                    self.component.copyImageToFolder()
                except ImportError, e:
                    tkMessageBox.showerror("Unable to import PIL","Please install PIL or unselect checkbox")
                    return

                # add references to the image file, can get error if component already exists
                try:
                    self.component.addImageReference()
                except DuplicateError, e:
                    tkMessageBox.showerror("Duplicate Component","%s already exists" % self.component.compName)
                    return

                # will create mock component if is visible and add references to SimpleComponentDescriptor
                self.component.createMockComponent()

                # will create the actual component file
                self.component.createComponent()

                tkMessageBox.showinfo('Success', 'Component created successfully')
# Create Generator Type Dropdown Widgets
GenType_lbl = Label(root,
                    text="Choose Generator Type: ",
                    fg=textcol,
                    bg=bgColor)
GenType_lbl.place(x=20, y=20, height=20)
GenType_tlt = CreateToolTip(GenType_lbl,
                            "Choose what type of noise generator to use")

GenType_dpd = Combobox(root,
                       values=GenTypeOptions,
                       textvariable=GenVar,
                       takefocus=True,
                       state="readonly")
GenType_dpd.set(GenTypeOptions[3])
GenType_dpd.place(x=170, y=20, height=20)

#Create Gridsize Entry Widget

Grid_lbl = Label(root, text="GridSize:", fg=textcol, bg=bgColor)
Grid_lbl.place(x=20, y=50, height=20)

Grid_tlt = CreateToolTip(
    Grid_lbl,
    "Use values no lower than 2. High values take longer to generate, and cost more memory."
)

gridx_lbl = Label(root, text="X:", fg=textcol, bg=bgColor)
gridx_lbl.place(x=80, y=50, height=20, width=40)
grids_x = Entry(root, bg=bgColor, fg=textcol)
grids_x.insert(2, "16")
class Application(Frame):
    def __init__(self, master=None):
        Frame.__init__(self, master)
        self.pack(fill=BOTH, expand=1)
        self.initUI()
        self.setGeometry()
        self.component = NewComponent()

    def setGeometry(self):
        x = 300
        y = 100
        self.master.geometry("400x300+%d+%d" % (x, y))
        self.master.update()

    def initUI(self):
        #setup title
        self.master.title("Component Creator")
        self.style = Style()
        self.style.theme_use("clam")

        #indicator label
        self.labelName = Label(self, text="Component Name:")
        self.labelName.place(x=10, y=10)
        self.master.update()

        # create variable and namefield for input of component name
        sv = StringVar()
        sv.trace("w", lambda name, index, mode, sv=sv: self.nameChanged(sv))
        self.nameField = Entry(self, textvariable=sv)
        self.nameField.place(x=10 + self.labelName.winfo_width() + 10, y=10)
        self.master.update()

        # label for image name that will show img name for a given component name
        self.imgNameVar = StringVar()
        self.imgNameVar.set('imageName:')
        self.labelImageName = Label(self, textvariable=self.imgNameVar)
        self.labelImageName.place(x=10 + self.labelName.winfo_width() + 10,
                                  y=40)

        # checkbox for visible component or not
        self.cbVar = IntVar()
        self.cb = Checkbutton(self,
                              text="Visible Component",
                              variable=self.cbVar)
        self.cb.place(x=10, y=70)

        # dropdown list for category
        self.labelCategory = Label(self, text="Category:")
        self.labelCategory.place(x=10, y=110)
        self.master.update()

        acts = [
            'UserInterface', 'Layout', 'Media', 'Animation', 'Sensors',
            'Social', 'Storage', 'Connectivity', 'LegoMindStorms',
            'Experimental', 'Internal', 'Uninitialized'
        ]

        self.catBox = Combobox(self, values=acts)
        self.catBox.place(x=10 + self.labelCategory.winfo_width() + 10, y=110)

        # button to select icon image
        self.getImageButton = Button(self,
                                     text="Select icon",
                                     command=self.getImage)
        self.getImageButton.place(x=10, y=150)
        self.master.update()

        # explanation for resizing
        self.resizeVar = IntVar()
        self.resizeCB = Checkbutton(
            self,
            text="ON=Resize Image (Requires PIL)\nOFF=Provide 16x16 Image",
            variable=self.resizeVar)
        self.resizeCB.place(x=10 + self.getImageButton.winfo_width() + 10,
                            y=150)

        # create button
        self.createButton = Button(self, text="Create", command=self.create)
        self.createButton.place(x=10, y=230)

        #cancel button
        self.cancelButton = Button(self, text="Cancel", command=self.quit)
        self.cancelButton.place(x=200, y=230)

    # open file picker for selecting an icon
    def getImage(self):
        ftypes = [('All Picture Files', ('*.jpg', '*.png', '*.jpeg', '*.bmp')),
                  ('All files', '*')]
        self.component.imgFile = askopenfilename(filetypes=ftypes,
                                                 title="Select an Icon file")

    # update component name and image name for component by lowercasing first letter
    def nameChanged(self, sv):
        s = sv.get()
        self.component.compName = s
        self.component.compImgName = s[:1].lower() + s[1:] if s else ''
        self.imgNameVar.set('imageName: %s' % self.component.compImgName)

    # tries to create component
    def create(self):
        # sets parameters for new component based on input values
        self.component.visibleComponent = bool(self.cbVar.get())
        self.component.resizeImage = bool(self.resizeVar.get())
        self.component.category = self.catBox.get().upper()
        self.component.compName = self.nameField.get()

        try:
            # check if component already exists
            try:
                open(
                    '../../components/src/com/google/appinentor/components/runtime/%s.java',
                    'r')
                tkMessageBox.showerror(
                    "Duplicate Component",
                    "%s already exists" % self.component.compName)
            # if doesnt exist will raise error
            except IOError:
                # check for name input
                if not self.component.compImgName:
                    tkMessageBox.showerror("Missing Name",
                                           "Please enter component name")
                    return

                #check for category selection
                if not self.component.category:
                    tkMessageBox.showerror("Missing Category",
                                           "Please select a category")
                    return

                # check if selected an icon
                if not self.component.imgFile:
                    tkMessageBox.showerror("Missing Icon",
                                           "Please select an icon image")
                    return

                # copy image file to folder, can get error if user checked resize and doest have PIL installed
                try:
                    self.component.copyImageToFolder()
                except ImportError, e:
                    tkMessageBox.showerror(
                        "Unable to import PIL",
                        "Please install PIL or unselect checkbox")
                    return

                # add references to the image file, can get error if component already exists
                try:
                    self.component.addImageReference()
                except DuplicateError, e:
                    tkMessageBox.showerror(
                        "Duplicate Component",
                        "%s already exists" % self.component.compName)
                    return

                # will create mock component if is visible and add references to SimpleComponentDescriptor
                self.component.createMockComponent()

                # will create the actual component file
                self.component.createComponent()

                tkMessageBox.showinfo('Success',
                                      'Component created successfully')
Пример #6
0
class main:
    def __init__(self, master):

#-----------------------Interface gráfica----------------------------------------------------
        self.frame1 = Frame(master, bg = COR_FUNDO)
        self.frame1.place(relheight = 1.0, relwidth = 1.0)

        self.botao_refresh = Button(self.frame1, text = 'Atualizar dispositivos', font = ('Courier','10'),
                                     fg = 'black', bg = COR_BOTAO_2, borderwidth = 3,
                                     command = self.devices)
        self.botao_refresh.place(relx = 0.202, rely = 0.02, relwidth = 0.54)
        
        Label(self.frame1, text = 'Escolha o dispositivo(CUIDADO)',
              font=('Courier','14'), fg = 'red', bg = COR_FUNDO).place(relx = 0.02, rely = 0.12)
        self.device = Combobox(self.frame1, font = ('Ariel','15'))
        self.device.place(relx = 0.04, rely = 0.20, relwidth = 0.90)

        Label(self.frame1, text='Escolha o Sistema de arquivos',
              font=('Courier','14'), fg = 'white', bg = COR_FUNDO).place(relx = 0.02, rely = 0.32)
        self.sis = Combobox(self.frame1, font = ('Ariel','15'))
        self.sis.place(relx = 0.04, rely = 0.40, relwidth = 0.90)

        self.botao_formatar = Button(self.frame1, text = 'Formatar', font = ('Courier','25'),
                                     fg = 'black', bg = COR_BOTAO_1, borderwidth = 3,
                                     command = self.formatar)
        self.botao_formatar.bind("<Button-1>", self.mudabotao)
        self.botao_formatar.place(relx = 0.21, rely = 0.82, relwidth = 0.54)

        self.devices()
        self.sis_file()
#----------------------Funções---------------------------------------------------------------        
    def devices(self):        
        #devices =  subprocess.check_output(['cat','/proc/partitions']).split('\n')
        self.device['values'] = USBdrv().mounted_drvs

    def sis_file(self):
        sis_file = ['ext2','vfat','ntfs','reiserfs']
        self.sis['values'] = sis_file

    def mudabotao(self,event):
        self.botao_formatar['text'] = 'Espere'

    def formatar(self):
        
        dv = self.device.get()
        st = self.sis.get()

        try:
            subprocess.call(['umount','%s'%dv])
            if st == 'vfat':
                subprocess.call(['mkfs.vfat', '%s' %dv])
                
            elif st == 'ntfs':
                subprocess.call(['mkfs.ntfs', '%s' %dv])

            elif st == 'reiserfs':
                subprocess.call(['mkfs.reiserfs', '%s' %dv])

            else:
                subprocess.call(['mkfs.ext2', '%s' %dv])

            tkMessageBox.showinfo('Aviso!',u'Device formatado com sucesso')
                
        except:
            tkMessageBox.showinfo('Erro!',u'Device ocupado, ou inválido, ou você não é root')
                
        self.devices()
        self.botao_formatar['text'] = 'Formatar'      
Пример #7
0
class oknoGUI(object):
    def __init__(self):
        self.oknoGlowne = Tk()
	self.okno = None
        self.okno_szer = 250
        self.okno_wys = 250
        self.siec=tworzenie_sieci();
        self.img = None
        self.rysowanie = None
        self.inicjacja()

    def inicjacja(self):
        self.oknoGlowne.title( "OCR CYFR" )
	self.oknoGlowne.geometry('252x500')
        self.okno = Canvas(self.oknoGlowne, width=self.okno_szer, height=self.okno_wys, bg='black')
	self.okno.place(x=0, y=0)
        self.okno.bind( "<B1-Motion>", self.maluj )

        self.img = Image.new('RGB', (self.okno_szer, self.okno_wys), 'black')
        self.rysowanie = ImageDraw.Draw(self.img)

	label3=Label(self.oknoGlowne,text="wynik ",fg="black")
	label3.place(x=10, y=251)
	
	self.wynik=Entry(self.oknoGlowne)
	self.wynik.place(x=75, y=251)

        self.odczytButton = Button(self.oknoGlowne, text='Odczytaj', command=self.odczytaj, anchor = SW)
        self.odczytButton.place(x=10, y=281)

        self.wyczyscButton = Button(self.oknoGlowne, text='Wyczysc', command=self.wyczysc, anchor = NW)
        self.wyczyscButton.place(x=100, y=281)
	
	self.testButton = Button(self.oknoGlowne, text='Test', command=self.test, anchor = SW)
        self.testButton.place(x=190, y=281)
	
	label1=Label(self.oknoGlowne,text="liczba iteracji treningu",fg="black")
	label1.place(x=0, y=311)

	data=(1,2,3,4,5,6,7,8,9,10)
	self.liczba_iteracji=Combobox(self.oknoGlowne,values=data,width=5)
	self.liczba_iteracji.current(0)
	self.liczba_iteracji.place(x=150, y=311)	

        self.uczenieButton= Button(self.oknoGlowne, text='uczenie', command=self.ucz, anchor = S)
	self.uczenieButton.place(x=100, y=331)
 	
	label3=Label(self.oknoGlowne,text="nazwa pliku",fg="black")
	label3.place(x=1, y=371)

	self.nazwa_pliku_1=Entry(self.oknoGlowne,width=15)
	self.nazwa_pliku_1.insert(END,'siec.h5')
	self.nazwa_pliku_1.place(x=100, y=371)

	self.ladujButton= Button(self.oknoGlowne, text='ladowanie', command=self.laduj, anchor = S)
	self.ladujButton.place(x=100, y=391)
	
	label2=Label(self.oknoGlowne,text="nazwa pliku",fg="black")
	label2.place(x=1, y=431)
	
	self.nazwa_pliku=Entry(self.oknoGlowne,text='siec.h5',width=15)
	self.nazwa_pliku.insert(END,'siec.h5')
	self.nazwa_pliku.place(x=100, y=431)

	self.zapiszButton = Button(self.oknoGlowne, text='zapisz', command=self.zapisz, anchor = S)
	self.zapiszButton.place(x=100, y=451)	
		
        mainloop()
        self.img.close()

        img = Image.open('img/temp.jpg')
        img = img.resize((28,28))
        img.save('img/temp.jpg')
        img.close()

    def wyczysc(self):
        self.okno.delete("all")
        self.img = Image.new('RGB', (self.okno_szer, self.okno_wys), 'black')
        self.rysowanie = ImageDraw.Draw(self.img)
	self.wynik.delete(0,END)

    def odczytaj(self):
        plik="img/temp.jpg"
        self.img.save(plik)
	wynik_img=odczyt_img(plik,self.siec)
	print('\nwynik: ')
	print(wynik_img)
	self.wynik.insert(END,wynik_img)
	
 	self.okno.delete("all")
	self.img = Image.new('RGB', (self.okno_szer, self.okno_wys), 'black')
        self.rysowanie = ImageDraw.Draw(self.img)

    def ucz(self):
	self.odczytButton.config(state="disable")
	self.wyczyscButton.config(state="disable")
	self.uczenieButton.config(state="disable")
	self.zapiszButton.config(state="disable")
	self.ladujButton.config(state="disable")
	self.testButton.config(state="disable")
	self.okno.config(state="disable")
	self.oknoGlowne.update()

	iteracja=int(self.liczba_iteracji.get())

	if iteracja > 0 and iteracja < 11:
       		try:
			self.siec=uczenie_sieci(self.siec,iteracja)
			tkMessageBox.showinfo('sykces', 'Uczenie Zakonczone!')
		except:
			tkMessageBox.showerror('Error', 'nieznany blad uczenia sie!')
		
	else:
		tkMessageBox.showerror('Error', 'bledna liczba iteracji!')

        self.okno.config(state="normal")
        self.odczytButton.config(state="normal")
	self.wyczyscButton.config(state="normal")
	self.uczenieButton.config(state="normal")
	self.zapiszButton.config(state="normal")
	self.ladujButton.config(state="normal")
	self.testButton.config(state="normal")
	self.oknoGlowne.update()
  
    def zapisz(self):
	nazwa=self.nazwa_pliku.get()

	if len(nazwa) != 0 :
		zapsi_model(self.siec, nazwa)
		tkMessageBox.showinfo("sykces", "Zapisano pomyslnie!")
	else:
		tkMessageBox.showerror('Error', 'brak nazwy pliku!')

	
    def laduj(self):
	self.odczytButton.config(state="disable")
	self.wyczyscButton.config(state="disable")
	self.uczenieButton.config(state="disable")
	self.zapiszButton.config(state="disable")
	self.ladujButton.config(state="disable")
	self.testButton.config(state="disable")
	self.okno.config(state="disable")
	self.oknoGlowne.update()
		
	nazwa=self.nazwa_pliku_1.get()

	if len(nazwa)!=0:
        	self.siec=wczytaj_model(nazwa)
		tkMessageBox.showinfo('sykces', 'Zaladowano pomylnie!')
	else:
		tkMessageBox.showerror('Error', 'brak nazwy pliku!')

	self.okno.config(state="normal")
        self.odczytButton.config(state="normal")
	self.wyczyscButton.config(state="normal")
	self.uczenieButton.config(state="normal")
	self.zapiszButton.config(state="normal")
	self.ladujButton.config(state="normal")
	self.testButton.config(state="normal")
	self.oknoGlowne.update()
	
    def test(self):
	self.odczytButton.config(state="disable")
	self.wyczyscButton.config(state="disable")
	self.uczenieButton.config(state="disable")
	self.zapiszButton.config(state="disable")
	self.ladujButton.config(state="disable")
	self.testButton.config(state="disable")
	self.okno.config(state="disable")
	self.oknoGlowne.update()

	self.wynik.delete(0,END)
	self.wynik.insert(END,test_mnist(self.siec)) 
	
	self.okno.config(state="normal")
        self.odczytButton.config(state="normal")
	self.wyczyscButton.config(state="normal")
	self.uczenieButton.config(state="normal")
	self.zapiszButton.config(state="normal")
	self.ladujButton.config(state="normal")
	self.testButton.config(state="normal")
	self.oknoGlowne.update()

    def maluj(self, clik):
        x1, y1 = clik.x, clik.y
        x2, y2 = ( clik.x + 10), ( clik.y + 10 )
        self.okno.create_oval( x1, y1, x2, y2, fill = "#FFFFFF", width=0 )
        self.rysowanie.ellipse([x1,y1,x2,y2], fill='white')