backpack.query

Useful functions for everyday use —> query and copy2clipboard

brixs.backpack.query.operating_system()

Return string with name of operating system (windows, linux, or mac).

brixs.backpack.query.query(question, default='yes')

Ask a yes/no question and return answer.

Note

It accepts many variations of yes and no as answer, like, “y”, “YES”, “N”, …

Parameters:
  • question (str) – string that is presented to the user.

  • default ('yes', 'no' or None) – default answer if the user just hits <Enter>. If None, an answer is required of the user.

Returns:

True for “yes” or False for “no”.

brixs.backpack.query.copy2clipboard(txt)

Copy text to clipboard.

on linux it uses xclip package (sudo apt install xclip).

brixs.backpack.query.svg2clipboard(filepath)

Copy svg pictures to clipboard.

Warning

Only implemented on Linux.

On linux it uses xsel package (sudo apt-get install -y xsel).