# PetscDrawSetFromOptions
Sets the graphics type from the options database. Defaults to a PETSc X Windows graphics. 
## Synopsis
```
#include "petscdraw.h" 
#include "petscviewer.h" 
PetscErrorCode PetscDrawSetFromOptions(PetscDraw draw)
```
Collective


## Input Parameter

- ***draw -*** the graphics context



## Options Database Keys

- ***-nox -*** do not use X graphics (ignore graphics calls, but run program correctly)
- ***-nox_warning -*** when X Windows support is not installed this prevents the warning message from being printed
- ***-draw_pause <pause amount> -*** - -1 indicates wait for mouse input, -2 indicates pause when window is to be destroyed
- ***-draw_marker_type -*** <x,point>
- ***-draw_save [optional filename] -*** (X Windows only) saves each image before it is cleared to a file
- ***-draw_save_final_image [optional filename] -*** (X Windows only) saves the final image displayed in a window
- ***-draw_save_movie -*** converts image files to a movie  at the end of the run. See PetscDrawSetSave()
- ***-draw_save_single_file -*** saves each new image in the same file, normally each new image is saved in a new file with 'filename/filename_%d.ext'
- ***-draw_save_on_clear -*** saves an image on each clear, mainly for debugging
- ***-draw_save_on_flush -*** saves an image on each flush, mainly for debugging





## Note
Must be called after `PetscDrawCreate()` before the `PetscDraw` is used.


## See Also
 `PetscDraw`, `PetscDrawCreate()`, `PetscDrawSetType()`, `PetscDrawSetSave()`, `PetscDrawSetSaveFinalImage()`, `PetscDrawPause()`, `PetscDrawSetPause()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/classes/draw/interface/drawreg.c.html#PetscDrawSetFromOptions">src/sys/classes/draw/interface/drawreg.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex68.c.html">src/ksp/ksp/tutorials/ex68.c.html</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex69.c.html">src/ksp/ksp/tutorials/ex69.c.html</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/classes/draw/interface/drawreg.c)


[Index of all Draw routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
