Ejemplo n.º 1
0
    def __main(self):
        self.top = Widget.NewTop()
        frame = Widget.Labelframe(self.top)
        label = Widget.Label(frame)
        entry = Widget.Entry(frame)
        button1 = Widget.Button(frame)

        Window.widg = self.top
        Window.Top("Preference settint")

        Window.widg = frame
        Window.Config(text=u"设置偏好")
        Window.Pack()

        Window.widg = label
        Window.Config(text=u"文件路径:")
        Window.Pack(side="left")

        Window.widg = entry
        self.__entry_var = Window.ConfigVar("textvariable")
        Window.Config(state=Tkconstants.DISABLED)
        Window.Pack(side="left")

        Window.widg = button1
        command = basic.register_command(button1, self.__select_dir)
        Window.Config(text=u"打开文件", command=command)
        Window.Pack(side="left")
Ejemplo n.º 2
0
    def LabelWithEntryAndButton(cls, master, grid_tree):
        '''Sample usage
            from com.ui import ROOT    
            frame1 = Widget.Labelframe(ROOT,text = "YYYY")
            Window.widg = frame1        
            Window.Pack(side = "top", fill="both", expand="yes", padx = "0.2c")
            
            grid_tree = [
                        [(u"用户名:", u"登录")],
                        [(u"密码:", ""),(u"验证码:", "")], 
                    ]
            widgets = Components.LabelWithEntryAndButton(frame1, grid_tree)
            widgets[0][1].insert("end","hi handsome boy.")    
            ROOT.mainloop()
        '''
        result = []
        rows = len(grid_tree)
        for row in range(rows):
            result.append([])
            column = -1

            groups = grid_tree[row]
            for lable_name, button_name in groups:
                column = column + 1
                label = Widget.Label(master, text=lable_name)
                result[row].append(label)
                Window.widg = label
                Window.Grid(row, column, "w")

                column = column + 1
                entry = Widget.Entry(master)
                result[row].append(entry)
                Window.widg = entry
                Window.Grid(row, column, "ew")

                if button_name:
                    column = column + 1
                    button = Widget.Button(master, text=button_name)
                    result[row].append(button)
                    Window.widg = button
                    Window.Grid(row, column, "e")
        return result
Ejemplo n.º 3
0
    def __main(self):
        self.frame1         = Widget.Labelframe(ROOT)
        self.frame2         = Widget.Labelframe(ROOT)
        
        label_caseid        = Widget.Label(self.frame1)
        entry_caseid        = Widget.Entry(self.frame1)
        
        label_steps         = Widget.Label(self.frame1)
        text_steps          = Widget.Text(self.frame1)
        
        label_des_name      = Widget.Label(self.frame1)
        text_des_name       = Widget.Text(self.frame1)
        
        label_precommand    = Widget.Label(self.frame1)
        text_precommand     = Widget.Text(self.frame1)
        
        label_head          = Widget.Label(self.frame1)
        text_head           = Widget.Text(self.frame1)
        
        label_data          = Widget.Label(self.frame1)
        text_data           = Widget.Text(self.frame1)
        
        label_postcommand   = Widget.Label(self.frame1)
        text_postcommand    = Widget.Text(self.frame1)
        
        label_verify        = Widget.Label(self.frame1)
        text_verify         = Widget.Text(self.frame1)       
        
        label_casetype      = Widget.Label(self.frame1)
        text_casetype       = Widget.Entry(self.frame1)  
        
        label_author        = Widget.Label(self.frame1)
        text_author         = Widget.Entry(self.frame1)       
        
        list_control        = Widget.Listbox(self.frame2)
        


        text_conf={"width" : 40, "height" : 5}
        entry_conf = {"width":40}
        # frame1
        Window.widg = label_caseid
        Window.Config(text = "TestCaseID:")
        Window.Grid(row=0, column=0,sticky="w")             
        Window.widg = entry_caseid
        Window.Config(**entry_conf)
        Window.Grid(row=0, column=1,sticky="EW")        
                
        Window.widg = label_casetype
        Window.Config(text = "CaseType:")
        Window.Grid(row=1, column=0,sticky="w")             
        Window.widg = text_casetype
        Window.Config(**entry_conf)
        Window.Grid(row=1, column=1,sticky="EW")
        
        Window.widg = label_author
        Window.Config(text = "Tester:")
        Window.Grid(row=2, column=0,sticky="w")            
        Window.widg = text_author
        Window.Config(**entry_conf)
        Window.Grid(row=2, column=1,sticky="EW")  
        
        Window.widg = label_steps
        Window.Config(text = "Steps:")
        Window.Grid(row=3, column=0,sticky="w")                
        Window.widg = text_steps
        Window.Config(**text_conf)
        Window.Grid(row=3, column=1,sticky="EW")
        
        Window.widg = label_des_name
        Window.Config(text = "Description:")
        Window.Grid(row=4, column=0,sticky="w")            
        Window.widg = text_des_name
        Window.Config(**text_conf)
        Window.Grid(row=4, column=1,sticky="EW")        
        
        Window.widg = label_precommand
        Window.Config(text = "PreCommand:")
        Window.Grid(row=5, column=0,sticky="w")                
        Window.widg = text_precommand
        Window.Config(**text_conf)
        Window.Grid(row=5, column=1,sticky="EW")
        
        Window.widg = label_head
        Window.Config(text = "Head:")
        Window.Grid(row=6, column=0,sticky="w")                
        Window.widg = text_head
        Window.Config(**text_conf)
        Window.Grid(row=6, column=1,sticky="EW")
        
        Window.widg = label_data
        Window.Config(text = "Data:")
        Window.Grid(row=7, column=0,sticky="w")                
        Window.widg = text_data
        Window.Config(**text_conf)
        Window.Grid(row=7, column=1,sticky="EW")
        
        Window.widg = label_postcommand
        Window.Config(text = "PostCommand:")
        Window.Grid(row=8, column=0,sticky="w")                
        Window.widg = text_postcommand
        Window.Config(**text_conf)
        Window.Grid(row=8, column=1,sticky="EW")
        
        Window.widg = label_verify
        Window.Config(text = "Verify:")
        Window.Grid(row=9, column=0,sticky="w")                
        Window.widg = text_verify
        Window.Config(**text_conf)
        Window.Grid(row=9, column=1,sticky="EW")   
        
        Window.widg = self.frame1
        Window.Config(text = "Part1")
        Window.Pack(side="left",fill = Tkconstants.X)
        
        # frame2
        Window.widg = list_control
        self.console_output = Window.ConfigVar("listvariable")
        Window.Pack(side = "top", fill = Tkconstants.BOTH, expand="yes")
        
        Window.widg = self.frame2
        Window.Config(text = "Part3")
        Window.Pack(side = "left", fill = Tkconstants.BOTH, expand = Tkconstants.YES)