Show
Ignore:
Timestamp:
12/05/08 17:36:29 (20 months ago)
Author:
JensDiemer
Message:

VideoTools?:
* new: "demux_by_MPLS.py"
* eac3to.py is broken!

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • CodeSnippets/VideoTools/shared/tk_tools.py

    r1807 r1813  
    2929    return _ask(askopenfilename, *args, **kwargs) 
    3030 
     31def askopenfilename3(title, initialfile, filetypes): 
     32    file_path = askopenfilename2( 
     33        title=title, 
     34        initialfile=initialfile, 
     35        filetypes=filetypes, 
     36    ) 
     37    if file_path == "": 
     38        sys.exit() 
     39    else: 
     40        return file_path 
     41 
     42def askfilepath(filename): 
     43    return askopenfilename3( 
     44        title = "Please select '%s':" % filename, 
     45        initialfile=filename, 
     46        filetypes=[(filename,filename)] 
     47    ) 
    3148 
    3249def simple_input(title, pre_lable, init_value, post_lable): 
     
    113130        self.root.destroy() 
    114131 
     132 
     133 
     134def simple_select(items, title="Select", text="Please select:"): 
     135    root = tk.Tk() 
     136    root.title(title) 
     137    tk.Label(root, text=text, font = "Tahoma 9 bold").pack() 
     138 
     139    var = tk.IntVar() 
     140    for no, item in enumerate(items): 
     141        r = tk.Radiobutton(root, text=item, variable=var, value=no) 
     142        r.pack() 
     143 
     144    tk.Button(root, text = "OK", command=root.destroy).pack(side=tk.RIGHT) 
     145    tk.Button(root, text = "Abort", command=sys.exit).pack(side=tk.RIGHT) 
     146    tk.mainloop() 
     147     
     148    selection = var.get() 
     149    selected_item = items[selection] 
     150    return selected_item