ISDITO PROBLEM WITH CLASS AND TINKER

isdito isdito at terra.es
Wed May 14 08:21:05 EDT 2003


Hello for all the people I am new in the foro, I will like ask you,
that I have problem with the class, in thinker I create a class to
create a menu, in a button of that menu, have other folder, but when I
push this button the folder return but empty, not have values.
If any people can help me? I put the code to give me a solution or say
me where is the problem.
When I execute the second class separate work well.


from Tkinter import *
from socket import *
import types
import string
import Tkinter


class CONECTION(Tkinter.Frame):
        def conectar(self):
            global maquina2
            HOST =maquina2
            PORT = 5123       
            self.s=socket(AF_INET, SOCK_STREAM)
            self.s.connect((HOST,PORT))
            print self.s
            
        def interface(self):
            global maquina2
            maquina2=StringVar()
            print maquina2.get()
            self.etiqueta=Label(self.ventana,relief=SUNKEN, text="IP
MACHINE").pack(side=LEFT,padx=10)
            self._orde=Entry(self.ventana, width=40,
textvariable=maquina2).pack(side=LEFT,padx=10)
            self.ventana.pack(side=LEFT)
            maquina2.set("ip de la maquina")
            self.boton=Button(self.ventana,text='CONECTAR',command=self.conectar).pack(side=LEFT,padx=10)
            self.ventana.pack(side=LEFT,padx=10)
            return 1
    
        
        def __init__(self):
            self.root=Tk()
            self.root.title("mi ventana de conexion")
            self.ventana=Frame(self.root,relief=FLAT,borderwidth=2)
            self.interface()
            
            
            
class MENU(Tkinter.Frame):
    def value_mas(self):
        dato="ipf.map0 = "+ str(self.valor)+ ";"
        self.valor+=0.2
        self.s.send(dato)

    def value1_menos(self):
        dato="ipf.map1 = "+ str(self.valor)+ ";"
        self.valor-=0.2
        self.s.send(dato)

    def reset(self): 
        dato = "itemset(\'map1\', \'EXP_EXE\');"
        self.send(dato)
        print dato
        self.slider0.set(0)
        self.slider1.set(0)
        
    def makeCommandMenu(self):
        self.menu1=Menubutton(self.root ,text='buttons
commands',underline=0)
        self.menu1.pack(side=LEFT,padx="2m")
        self.menu1.menu=Menu(self.menu1)
        self.menu1.menu.add_command(label='undo')
        self.menu1.menu.entryconfig(0,state=DISABLED)
        self.menu1.menu.add_command(label='open conection.....',
command=conectando)
        self.menu1.menu.add_command(label='MAS',command=self.value_mas)
        self.menu1.menu.add_command(label='MENOS',command=self.value1_menos)
        self.menu1['menu']= self.menu1.menu
        return self.menu1
    
    def __init__(self,title='MANOLO'):
        self.valor=0.1
        self.root=Tk()
        self.root.title(title)
        self.ventana=Frame(self.root,relief=RAISED,borderwidth=2)
        Label(self.root,text="haber si funciona").pack(side=LEFT)
        menus=self.makeCommandMenu()
        self.ventana.tk_menuBar(menus)
        self.root.mainloop()

def conectando():
    test=CONECTION()
    test.root.mainloop()

class MENU2(Tkinter.Frame):
        def interface(self):
            self.etiqueta=Label(self.ventana,relief=SUNKEN,
text="PANEL").pack(side=LEFT,padx=10)
            self.boton=Button(self.ventana,text='CONECTAR',command=conectando).pack(side=LEFT,padx=10)
            self.boton1=Button(self.ventana,text='DESCONECTAR',command='print
"holalal"').pack(side=LEFT,padx=10)
            self.boton2=Button(self.ventana,text='OBJETOS',command='print
"kdlkdlkdlkd"').pack(side=LEFT,padx=10)
            self.ventana.pack(side=LEFT)
            print "wwww"
            self.boton4=Button(self.ventana,text='CONECTAR',command='').pack(side=LEFT,padx=10)
            print "wwww"
            self.ventana.pack(side=LEFT,padx=10)
            return 1
    
        
        def __init__(self):
            self.root=Tk()
            self.root.title("mi menu2")
            self.ventana=Frame(self.root,relief=FLAT,borderwidth=2)
            self.interface()
            self.root.mainloop()
 
            
            


global test      
#menu =MENU2();
conectando()


My email is israel at idlight3d.com
www.idlight3d.com

thanks for all I hope have a response




More information about the Python-list mailing list