User Tools

Site Tools


tinypy:gui

GUI Class

The GUI class enables you to create dialog and other UI related operations. This page will assume you created an instance using gui=Gui()

gui.displayError(str type,str message)

Popup an error message dialog. Type and message are strings, you can put whetever you want.

gui.displayError("File error","This file does not exist")

gui.displayInfo(str type,str message)

Popup an info message dialog. Type and message are strings, you can put whetever you want.

gui.displayInfo("Encoding","Encoding done")

Selecting files and folders

gui.dirSelect(str title)

Open the file selector to select a folder. The selected path is returned. Title is the title of the file selector.

 folder=gui.dirSelect("Select the source folder")

gui.fileReadSelect(str title)

Open the file selector to open a file in read mode.

gui.fileWriteSelect(str title)

Open the file selector to open a file in write mode. If the file already exists, you'll be prompted to overwrite it.

Scanning folders

get_folder_content(folder,ext) Return a list of file in folder 'folder“ with extension 'ext'. For exampl e:

lst=get_folder_content("/home/foo/videos","avi")

will return all .avi files in the folder /home/foo/videos. Beware this is a function, not attached to gui or adm.

Manipulating paths

dirname(path)

Return the dir that leads to path

dirname("/c/foo/bar.txt")=>"/c/foo"

basename(path)

Return the filename only

basename("/c/foo/bar.txt")=>"bar.txt"

Getting a file size

get_file_size(file)

Return the size of the file 'file”


Go back to tinypy

tinypy/gui.txt · Last modified: 2013/05/02 16:27 by fx