当前位置: 首页>>代码示例>>Python>>正文


Python Frame.grid_forget方法代码示例

本文整理汇总了Python中ttk.Frame.grid_forget方法的典型用法代码示例。如果您正苦于以下问题:Python Frame.grid_forget方法的具体用法?Python Frame.grid_forget怎么用?Python Frame.grid_forget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ttk.Frame的用法示例。


在下文中一共展示了Frame.grid_forget方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1:

# 需要导入模块: from ttk import Frame [as 别名]
# 或者: from ttk.Frame import grid_forget [as 别名]
file_text = fp.read()
input_txt_updated.insert('0.0', file_text)
fp.close()



used_background = "green"
unrelevant_background = "grey"
# here we configure the highlighting

input_txt.tag_configure("relatioship_highlight",background=relationship_background)
input_txt.tag_configure("relevant_term_highlight",background=relevant_term_background)
input_txt.tag_configure("used_highlight",background=used_background)
input_txt.tag_configure("unrelevant_highlight",background=unrelevant_background)

input_txt_updated.tag_configure("relatioship_highlight",background=relationship_background)
input_txt_updated.tag_configure("relevant_term_highlight",background=relevant_term_background)

input_txt_updated.tag_configure("used_highlight",background=used_background)
input_txt_updated.tag_configure("unrelevant_highlight",background=unrelevant_background)

######################################################################
for child in inputdoc_frm.winfo_children(): child.grid_configure(padx=5, pady=5)
for child in mainframe.winfo_children(): child.grid_configure(padx=5, pady=5) 
for child in supermainframe.winfo_children(): child.grid_configure(padx=5, pady=5) 

#here we hide the form
inputdoc_frm_relationship.grid_forget()

root.mainloop()
开发者ID:alessioferrari,项目名称:requirements_completeness_advisor,代码行数:32,代码来源:GameManager.py

示例2: Reader

# 需要导入模块: from ttk import Frame [as 别名]
# 或者: from ttk.Frame import grid_forget [as 别名]

#.........这里部分代码省略.........
        Label(self.frame_left,text="Type D").pack(side=LEFT)
        rb1 = Radiobutton(self.frame_left,variable=self.classify_left,value="TypeD")
        rb1.pack(side=LEFT)
       
        
               
        self.classify_right = StringVar()
        Label(self.frame_right,text="Right  :").pack(side=LEFT)
        Label(self.frame_right,text="Type A").pack(side=LEFT)
        rb1 = Radiobutton(self.frame_right,variable=self.classify_right,value="TypeA")
        rb1.pack(side=LEFT)
        Label(self.frame_right,text="Type B").pack(side=LEFT)
        rb1 = Radiobutton(self.frame_right,variable=self.classify_right,value="TypeB")
        rb1.pack(side=LEFT)
        Label(self.frame_right,text="Type C").pack(side=LEFT)
        rb1 = Radiobutton(self.frame_right,variable=self.classify_right,value="TypeC")
        rb1.pack(side=LEFT)
        Label(self.frame_right,text="Type D").pack(side=LEFT)
        rb1 = Radiobutton(self.frame_right,variable=self.classify_right,value="TypeD")
        rb1.pack(side=LEFT)
              
               
    def load_data(self):
        # calls the file dialog box
        name = askopenfilename()
        (d_path,d_name)=split(name)
        # just want to extract the path of the file
        self.mypath = d_path
        # get 'filtered' files from that path
        files = self.get_files()
        # display in the list box
        self.file_list.load_data(files)
        
    def load_hunt_data(self,selection):
        (self.indx , self.filename) = selection
        d_file = join(self.mypath,self.filename)
        l_array=[]
        r_array=[]
        with open(d_file) as f:
            for line in f:
                data = line.split(',')
                if data[5]!='':
                    r_array.append(data[5]) # RL_PVR
                    l_array.append(data[6]) # LL_PVR
        self.rawy_l = numpy.array(l_array[1:]) # form 1 romove headder
        self.rawy_r = numpy.array(r_array[1:])
        self.rawx = [i for i in range(len(self.rawy_l))]
        # reset the classification buttons
        self.classify_left.set("TypeA")
        self.classify_right.set("TypeA")
        self.plot_left()

    def plot_left(self):
        # choose th correct fram of radio buttons
        self.frame_right.grid_forget()
        self.frame_left.grid(row=5,column=3,columnspan=2, rowspan=1)
        # change display name
        self.file_lbl.configure(text=self.filename+" : Left")
        self.graph_viewer.change_data(self.rawx,self.rawy_l)

    def plot_right(self):
        self.frame_left.grid_forget()
        self.frame_right.grid(row=5,column=3,columnspan=2, rowspan=1)
        self.file_lbl.configure(text=self.filename+" : Right")
        self.graph_viewer.change_data(self.rawx,self.rawy_r)
        
    def save_graph(self):
        self.file_list.remove_item(self.indx)
        d_file = join(self.mypath,self.filename)
        # add a done prefix to the file name
        n_file = join(self.mypath,"done-"+self.filename)
        rename(d_file,n_file)
        # get the front of the filename
        fparts = self.filename.split('.')
        # save data wit the same name but with the chanel prefix and a dat postfix
        l_file = join(self.mypath,self.classify_left.get()+'-Left-'+fparts[0]+'.dat')
        # open file to write
        f = open(l_file, 'w')
        for v in self.rawy_l:
            f.write(v+'\n')
        f.close()
        r_file = join(self.mypath,self.classify_right.get()+'-Right-'+fparts[0]+'.dat')
        # open file to write
        f = open(r_file, 'w')
        for v in self.rawy_r:
            f.write(v+'\n')
        f.close()
        

    def get_files(self):
        files = []
        for filename in listdir(self.mypath):
            # just get the files
            # note that it has to have the compleate path and name
            if isfile(join(self.mypath,filename)):
                # split the file name in to parts 
                files.append(filename)
                #parts = filename.split('.')
                #print parts[-1]
        return files
开发者ID:rcolasanti,项目名称:Wheeze,代码行数:104,代码来源:reader-0-2.py

示例3: GraphFrame

# 需要导入模块: from ttk import Frame [as 别名]
# 或者: from ttk.Frame import grid_forget [as 别名]
class GraphFrame(Frame):
    def __init__(self, parent, paned_window, **kwargs):
        Frame.__init__(self, paned_window)
        self.parent = parent

        self.df_column_frame = ScrolledFrame(self, vertflex='expand')

        self.graph_frame = ScrolledFrame(self, horizflex='expand', vertflex='expand')
        self.plot_figure = kwargs['plot'] if 'plot' in kwargs else None

        self.plot_title = kwargs['plot_title'] if 'plot_title' in kwargs else 'Line Plot'
        self.y_label = kwargs['y_label'] if 'y_label' in kwargs else 'y'
        self.df = kwargs['df'] if 'df' in kwargs else DataFrame() # If the dataframe wasn't passed in, then create an empty dataframe

        plot_selected_avg = ModelRunnerPlots.get_avg_plot(self.plot_title, self.y_label, self.df, None)
        self.plot_figure = plot_selected_avg
        self.graph_canvas = FigureCanvasTkAgg(plot_selected_avg, master=self.graph_frame.interior())

        self.col_list = list()

        for col in self.df.columns:
            if col != 'year' and 'Average' not in col:
                col_var = IntVar()
                col_var.set(0)
                col_checkbox = Checkbutton(self.df_column_frame.interior(), text=col, variable=col_var, command=self.on_col_check)
                self.col_list.append([col_var, col_checkbox, col])

        avg_dataframe, dataframe = ModelRunnerPlots.find_avg_dataframe(self.df)
        for col in avg_dataframe.columns:
            if col != 'year':
                col_var = IntVar()
                col_var.set(0)
                col_checkbox = Checkbutton(self.df_column_frame.interior(), text=col, variable=col_var, command=self.on_col_check)
                self.col_list.append([col_var, col_checkbox, col])

        self.log_filename_frame = Frame(self)
        self.log_label = Label(self.log_filename_frame, text='Logfile: ' + kwargs['log_filename']) if 'log_filename' in kwargs else None

        self.button_frame = Frame(self)
        self.close_button = Button(self.button_frame, text='Close', command=self.on_close)
        self.save_button = Button(self.button_frame, text='Save', command=self.on_save)

    def set_grid(self):
        #print 'Resizing graph frame'
        #self.grid(padx=4, pady=4)
        self.pack(padx=4, pady=4, expand=True, fill=Tkinter.BOTH)
        #self.rowconfigure(0, minsize=600)
        #self.columnconfigure(0, minsize=100)
        #self.columnconfigure(1, minsize=600)
        self.columnconfigure(0, weight=1)
        self.columnconfigure(1, weight=5)
        self.rowconfigure(0, weight=1)

        self.df_column_frame.grid(row=0, column=0, sticky=Tkinter.N + Tkinter.S + Tkinter.E + Tkinter.W)
        #self.df_column_frame.pack(side=Tkinter.LEFT, expand=True, fill=Tkinter.BOTH)
        row_index = 0
        for col in self.col_list:
            checkButton = col[1]
            checkButton.grid(sticky=Tkinter.E + Tkinter.W)
            row_index += 1

        self.graph_frame.grid(row=0, column=1, sticky=Tkinter.N + Tkinter.S + Tkinter.E + Tkinter.W)
        #self.graph_frame.pack(side=Tkinter.RIGHT, expand=True, fill=Tkinter.BOTH)
        try:
            self.graph_canvas.get_tk_widget().grid(row=0, column=0, sticky=Tkinter.N + Tkinter.S + Tkinter.E + Tkinter.W)
            #self.graph_canvas.get_tk_widget().pack(expand=True, fill=Tkinter.BOTH)
	except AttributeError:
		pass
        self.log_filename_frame.grid(row=1, column=0, sticky=Tkinter.N + Tkinter.S + Tkinter.E + Tkinter.W)
        if self.log_label != None:
            self.log_label.pack(side=Tkinter.LEFT)

        self.button_frame.grid(row=1, column=1, sticky=Tkinter.N + Tkinter.S + Tkinter.E + Tkinter.W)
        #self.button_frame.pack(side=Tkinter.BOTTOM, expand=True, fill=Tkinter.X)
        self.close_button.pack(side=Tkinter.RIGHT)
        self.save_button.pack(side=Tkinter.RIGHT)

    def unset_grid(self):
        self.pack_forget()
        self.df_column_frame.grid_forget()
        self.graph_frame.grid_forget()
	try:
        	self.graph_canvas.get_tk_widget().grid_forget()
	except AttributeError:
		pass
        self.log_filename_frame.grid_forget()
        if self.log_label != None:
            self.log_label.pack_forget()
        self.button_frame.grid_forget()
        self.close_button.pack_forget()
        self.save_button.pack_forget()

    def on_col_check(self):
        # Based upon what is checked, a new plot should be created
        value_vars = list()

        for col in self.col_list:
            if col[0].get() == 1:
                #print col[2] + ' is checked'
                value_vars.append(col[2])
#.........这里部分代码省略.........
开发者ID:jhavstad,项目名称:model_runner,代码行数:103,代码来源:ModelRunnerGraphGUI.py


注:本文中的ttk.Frame.grid_forget方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。