Sheet

class vanilla.Sheet(posSize, parentWindow, minSize=None, maxSize=None, autosaveName=None)

A window that is attached to another window.

../_images/Sheet.png

To add a control to a sheet, simply set it as an attribute of the sheet.:

from vanilla import Window, Sheet, Button

class SheetDemo:

    def __init__(self):
        self.w = Window((240, 140), "Sheet Demo")
        self.w.openSheet = Button((10, -30, -10, 20),
                    "open sheet", callback=self.openSheetCallback)
        self.w.open()

    def openSheetCallback(self, sender):
        self.sheet = Sheet((160, 70), self.w)
        self.sheet.closeSheet = Button((10, -30, -10, 20),
                    "close sheet", callback=self.closeSheetCallback)
        self.sheet.open()

    def closeSheetCallback(self, sender):
        self.sheet.close()
        del self.sheet

SheetDemo()

No special naming is required for the attributes. However, each attribute must have a unique name.

posSize Tuple of form (width, height) representing the size of the sheet.

parentWindow The window that the sheet should be attached to.

minSize Tuple of the form (width, height) representing the minimum size that the sheet can be resized to.

maxSize Tuple of the form (width, height) representing the maximum size that the sheet can be resized to.

autosaveName A string representing a unique name for the sheet. If given, this name will be used to store the sheet size in the application preferences.

center()

Center the window within the screen.

close()

Close the window.

Once a window has been closed it can not be re-opened.

getNSWindow()

Return the NSWindow that this Vanilla object wraps.

getNSWindowController()

Return an NSWindowController for the NSWindow that this Vanilla object wraps, creating a one if needed.

getPosSize()

A tuple of form (left, top, width, height) representing the window’s position and size.

getTitle()

The title in the window’s title bar.

hide()

Hide the window.

isVisible()

A boolean value representing if the window is visible or not.

makeKey()

Make the window the key window.

makeMain()

Make the window the main window.

open()

Open the window.

select()

Select the window if it is not the currently selected window.

show()

Show the window if it is hidden.