c4d.gui – the main module

To get an overview of the class members, check out the diagram.

Functions

Note

File dialogs are stored in c4d.storage.

//Dialogs

//Useful stuff

// Interactions

c4d.gui.MessageDialog(text[, type=GEMB_OK])

Display a message dialog with the string as the message:

from c4d import gui
gui.MessageDialog("Why do you take baths in milk?'\n'I can't find a cow tall enough for a shower.")
../../_images/messagedialog.png
Parameters:
  • text (str) – The string to print out.
  • type (int.) –

    Key, stored in c4d.gui.

    GEMB_OK OK.
    GEMB_OKCANCEL OK and Cancel.
    GEMB_ABORTRETRYIGNORE Abort, Retry and Ignore.
    GEMB_YESNOCANCEL Yes, No and Cancel.
    GEMB_YESNO Yes and No.
    GEMB_RETRYCANCEL Retry and Cancel.
Return type:

int

Returns:

Result of the messagebox, stored in c4d.gui.

GEMB_R_OK

OK button.

GEMB_R_CANCEL

Cancel button.

GEMB_R_ABORT

Abort button.

GEMB_R_RETRY

Retry button.

GEMB_R_IGNORE

Ignore button.

GEMB_R_YES

Yes button.

GEMB_R_NO

No button.

c4d.gui.QuestionDialog(text)

Opens a standard question dialog with a question mark icon and Yes/No buttons. The text is specified as a string:

from c4d import gui
rvalue = gui.QuestionDialog("Do you think I am a dialog?")
../../_images/questiondialog.png
Parameter:text (str) – The string to show.
Return type:bool
Returns:True if the user answered Yes, otherwise False.
c4d.gui.RenameDialog(text)

Opens a dialog to rename a string:

from c4d import gui
#name = op.GetName() #return the name of an object
rvalue = gui.RenameDialog(name) #pass it
#rvalue contains the name False if the user abort the dialog
../../_images/renamedialog.png
Parameter:text (str) – The string
Return type:str or False
Returns:Returns the changed string or False on abort.
c4d.gui.InputDialog(title[, preset])

Open an input dialog which returns the input string.

Returns text:The label string
Returns preset:The default value which will be written on popup
Return type:str
Returns:The input as string
c4d.gui.ColorDialog()

Open a color chooser dialog for the user to select a color. The look of this dialog depends on the operating system.

../../_images/choose_color.png
Return type:Vector or None
Returns:Returns a c4d.Vector on success, otherwise None
c4d.gui.FontDialog()

Open a font chooser dialog for the user to select a font. The look of this dialog depends on the operating system.

../../_images/choose_font.png
Return type:BaseContainer or None
Returns:Returns a c4d.BaseContainer with the font settings, otherwise None
c4d.gui.SelectionListDialog(arr, doc[, x][, y])

Shows a popup menu with of the given object tuple and lets the user choose an object at the position of the mouse.

Parameters:
  • arr (list of type BaseObject) – A list of BaseObjects.
  • doc (BaseDocument) – The document.
  • x (int) – X-Coordinate
  • y (int) – Y-Coordinate
Return type:

int

Returns:

The user choice or NOTOK if nothing was selected.

c4d.gui.ShowPopupDialog(x, y, bc, flags=POPUP_RIGHT|POPUP_EXECUTECOMMANDS)

Displays a popup menu:

import c4d
from c4d import gui

entries = c4d.BaseContainer()
entries.SetString(0, "Title&d&") #title, just append '&d&'
entries.SetString(2, "Hello")
entries.SetString(3, "World!")
result = gui.ShowPopupDialog(bc=entries, x=70, y=90)
print result
../../_images/show_popup_menu.png
Parameters:
  • x (int) – The X position.
  • y (int) – The Y position.
  • bc (BaseContainer) – The container with the elements. The elements has to be of type str. You can optional set a title with the ID 0 or just start with the first element with the ID 2. If you set a title, we recommend you to add the string &d& to the name of the title (see example) to grey it out. The title cannot be selected, even its not greyed out.
  • flags (int) –

    One of the following flags, stored in c4d.gui:

    POPUP_ABOVE Open above mouse.
    POPUP_BELOW Open below mouse.
    POPUP_CENTERVERT Open centered vertically around mouse.
    POPUP_LEFT Open to the left of the mouse.
    POPUP_RIGHT Open to the right of the mouse.
    POPUP_CENTERHORIZ Open centered horizontally around mouse.
    POPUP_EXECUTECOMMANDS Execute commands immediatly.
    POPUP_ALLOWUNDOCK Allow to undock popupmenu.
    POPUP_ALLOWUNDOCK_REC Allow to undock popupmenu for children.
Return type:

int

Returns:

The ID of the selected item, or 0 if nothing was selected.

c4d.gui.SetMousePointer(l)

Set the type of mouse pointer.

Parameter:l (int) –

Values for the mouse pointer image, stored in c4d.gui:

MOUSE_HIDE Hide cursor.
MOUSE_SHOW Show cursor.
MOUSE_NORMAL Normal cursor.
MOUSE_BUSY Busy cursor.
MOUSE_CROSS Cross cursor.
MOUSE_QUESTION Question cursor
MOUSE_ZOOM_IN Zoom in cursor.
MOUSE_ZOOM_OUT Zoom out cursor.
MOUSE_FORBIDDEN Forbidden cursor.
MOUSE_DELETE Delete cursor.
MOUSE_COPY Copy cursor.
MOUSE_INSERTCOPY Insert copy cursor.
MOUSE_INSERTCOPYDOWN Insert copy down cursor.
MOUSE_MOVE Move cursor.
MOUSE_INSERTMOVE Insert move cursor.
MOUSE_INSERTMOVEDOWN Insert move cursor.
MOUSE_ARROW_H Horizontal cursor.
MOUSE_ARROW_V Vertical cursor.
MOUSE_ARROW_HV Horizontal and vertical arrow cursor.
MOUSE_POINT_HAND Point hand cursor.
MOUSE_MOVE_HAND Move hand cursor.
MOUSE_IBEAM I-beam cursor.
MOUSE_SELECT_LIVE Live selection cursor.
MOUSE_SELECT_FREE Free selection cursor.
MOUSE_SELECT_RECT Rectangle selection cursor.
MOUSE_SELECT_POLY Polygon selection cursor.
MOUSE_SPLINETOOLS Spline tools cursor.
MOUSE_EXTRUDE Extrude cursor.
MOUSE_NORMALMOVE Normal move cursor.
MOUSE_ADDPOINTS Add points cursor.
MOUSE_ADDPOLYGONS Add polygons cursor.
MOUSE_BRIDGE Bridge cursor.
MOUSE_MIRROR Mirror cursor.
MOUSE_PAINTMOVE Paint move cursor.
MOUSE_PAINTSELECTRECT Paint select rectangle cursor.
MOUSE_PAINTSELECTCIRCLE Paint select circle cursor.
MOUSE_PAINTSELECTPOLY Paint select polygon cursor.
MOUSE_PAINTSELECTFREE Paint select free cursor.
MOUSE_PAINTMAGICWAND Paint magic wand cursor.
MOUSE_PAINTCOLORRANGE Paint color range cursor.
MOUSE_PAINTFILL Paint fill cursor.
MOUSE_PAINTPICK Paint pick cursor.
MOUSE_PAINTBRUSH Paint brush cursor.
MOUSE_PAINTCLONE Paint clone cursor.
MOUSE_PAINTTEXT Paint text cursor.
MOUSE_PAINTCROP Paint crop cursor.
MOUSE_PAINTLINE Paint line cursor.
MOUSE_PAINTPOLYSHAPE Paint polygon shape cursor.

Table Of Contents

This Page