Skip to content

PyGumps

No properties found.

No fields found.

No enums found.

(acceptMouseInput, canMove, keepOpen) Get a blank gump. Example:

g = API.CreateGump()
g.SetRect(100, 100, 200, 200)
g.Add(API.CreateGumpLabel("Hello World!"))
API.AddGump(g)

Parameters:

NameTypeOptionalDescription
acceptMouseInputbool✅ YesAllow clicking the gump
canMovebool✅ YesAllow the player to move this gump
keepOpenbool✅ YesIf true, the gump won’t be closed if the script stops. Otherwise, it will be closed when the script is stopped. Defaults to false.

Return Type: PyBaseGump


(x, y, width, height, resizable, minWidth, minHeight, onResized) Creates a modern nine-slice gump using ModernUIConstants for consistent styling. The gump uses the standard modern UI panel texture and border size internally.

Parameters:

NameTypeOptionalDescription
xint❌ NoX position
yint❌ NoY position
widthint❌ NoInitial width
heightint❌ NoInitial height
resizablebool✅ YesWhether the gump can be resized by dragging corners (default: true)
minWidthint✅ YesMinimum width (default: 50)
minHeightint✅ YesMinimum height (default: 50)
onResizedobject✅ YesOptional callback function called when the gump is resized

Return Type: PyNineSliceGump


(g) Add a gump to the players screen. Example:

g = API.CreateGump()
g.SetRect(100, 100, 200, 200)
g.Add(API.CreateGumpLabel("Hello World!"))
API.AddGump(g)

Parameters:

NameTypeOptionalDescription
gobject❌ NoThe gump to add

Return Type: void (Does not return anything)


(text, hue, isChecked) Create a checkbox for gumps. Example:

g = API.CreateGump()
g.SetRect(100, 100, 200, 200)
cb = API.CreateGumpCheckbox("Check me?!")
g.Add(cb)
API.AddGump(g)
API.SysMsg("Checkbox checked: " + str(cb.IsChecked))

Parameters:

NameTypeOptionalDescription
textstring✅ YesOptional text label
hueushort✅ YesOptional hue
isCheckedbool✅ YesDefault false, set to true if you want this checkbox checked on creation

Return Type: PyCheckbox


(text, hue) Create a label for a gump. Example:

g = API.CreateGump()
g.SetRect(100, 100, 200, 200)
g.Add(API.CreateGumpLabel("Hello World!"))
API.AddGump(g)

Parameters:

NameTypeOptionalDescription
textstring❌ NoThe text
hueushort✅ YesThe hue of the text

Return Type: PyLabel


(opacity, color) Get a transparent color box for gumps. Example:

g = API.CreateGump()
g.SetRect(100, 100, 200, 200)
cb = API.CreateGumpColorBox(0.5, "#000000")
cb.SetWidth(200)
cb.SetHeight(200)
g.Add(cb)
API.AddGump(g)

Parameters:

NameTypeOptionalDescription
opacityfloat✅ Yes0.5 = 50%
colorstring✅ YesHtml color code like #000000

Return Type: PyAlphaBlendControl


(graphic, width, height) Create a picture of an item. Example:

g = API.CreateGump()
g.SetRect(100, 100, 200, 200)
g.Add(API.CreateGumpItemPic(0x0E78, 50, 50))
API.AddGump(g)

Parameters:

NameTypeOptionalDescription
graphicuint❌ No
widthint❌ No
heightint❌ No

Return Type: PyResizableStaticPic


(text, hue, normal, pressed, hover) Create a button for gumps. Example:

g = API.CreateGump()
g.SetRect(100, 100, 200, 200)
button = API.CreateGumpButton("Click Me!")
g.Add(button)
API.AddGump(g)
while True:
API.SysMsg("Button currently clicked?: " + str(button.IsClicked))
API.SysMsg("Button clicked since last check?: " + str(button.HasBeenClicked()))
API.Pause(0.2)

Parameters:

NameTypeOptionalDescription
textstring✅ Yes
hueushort✅ Yes
normalushort✅ YesGraphic when not clicked or hovering
pressedushort✅ YesGraphic when pressed
hoverushort✅ YesGraphic on hover

Return Type: PyButton


(text, width, height) Create a simple button, does not use graphics. Example:

g = API.CreateGump()
g.SetRect(100, 100, 200, 200)
button = API.CreateSimpleButton("Click Me!", 100, 20)
g.Add(button)
API.AddGump(g)

Parameters:

NameTypeOptionalDescription
textstring❌ No
widthint❌ No
heightint❌ No

Return Type: PyNiceButton


(text, group, inactive, active, hue, isChecked) Create a radio button for gumps, use group numbers to only allow one item to be checked at a time. Example:

g = API.CreateGump()
g.SetRect(100, 100, 200, 200)
rb = API.CreateGumpRadioButton("Click Me!", 1)
g.Add(rb)
API.AddGump(g)
API.SysMsg("Radio button checked?: " + str(rb.IsChecked))

Parameters:

NameTypeOptionalDescription
textstring✅ YesOptional text
groupint✅ YesGroup ID
inactiveushort✅ YesUnchecked graphic
activeushort✅ YesChecked graphic
hueushort✅ YesText color
isCheckedbool✅ YesDefaults false, set to true if you want this button checked by default.

Return Type: PyRadioButton


(text, width, height, multiline) Create a text area control. Example:

w = 500
h = 600
gump = API.CreateGump(True, True)
gump.SetWidth(w)
gump.SetHeight(h)
gump.CenterXInViewPort()
gump.CenterYInViewPort()
bg = API.CreateGumpColorBox(0.7, "#D4202020")
bg.SetWidth(w)
bg.SetHeight(h)
gump.Add(bg)
textbox = API.CreateGumpTextBox("Text example", w, h, True)
gump.Add(textbox)
API.AddGump(gump)

Parameters:

NameTypeOptionalDescription
textstring✅ Yes
widthint✅ Yes
heightint✅ Yes
multilinebool✅ Yes

Return Type: PyTTFTextInputField


(text, size, color, font, aligned, maxWidth, applyStroke) Create a TTF label with advanced options. Example:

gump = API.CreateGump()
gump.SetRect(100, 100, 200, 200)
ttflabel = API.CreateGumpTTFLabel("Example label", 25, "#F100DD", "alagard")
ttflabel.SetRect(10, 10, 180, 30)
gump.Add(ttflabel)
API.AddGump(gump) #Add the gump to the players screen

Parameters:

NameTypeOptionalDescription
textstring❌ No
sizefloat❌ NoFont size
colorstring✅ YesHex color: #FFFFFF. Must begin with #.
fontstring✅ YesMust have the font installed in TazUO
alignedstring✅ Yesleft/center/right. Must set a max width for this to work.
maxWidthint✅ YesMax width before going to the next line
applyStrokebool✅ YesUses players stroke settings, this turns it on or off

Return Type: PyTextBox


(width, height, backgroundColor, foregroundColor, value, max) Create a progress bar. Can be updated as needed with bar.SetProgress(current, max). Example:

gump = API.CreateGump()
gump.SetRect(100, 100, 400, 200)
pb = API.CreateGumpSimpleProgressBar(400, 200)
gump.Add(pb)
API.AddGump(gump)
cur = 0
max = 100
while True:
pb.SetProgress(cur, max)
if cur >= max:
break
cur += 1
API.Pause(0.5)

Parameters:

NameTypeOptionalDescription
widthint❌ NoThe width of the bar
heightint❌ NoThe height of the bar
backgroundColorstring✅ YesThe background color(Hex color like #616161)
foregroundColorstring✅ YesThe foreground color(Hex color like #212121)
valueint✅ YesThe current value, for example 70
maxint✅ YesThe max value(or what would be 100%), for example 100

Return Type: PySimpleProgressBar


(x, y, width, height) Create a scrolling area, add and position controls to it directly. Example:

sa = API.CreateGumpScrollArea(0, 60, 200, 140)
gump.Add(sa)
for i in range(10):
label = API.CreateGumpTTFLabel(f"Label {i + 1}", 20, "#FFFFFF", "alagard")
label.SetRect(5, i * 20, 180, 20)
sa.Add(label)

Parameters:

NameTypeOptionalDescription
xint❌ No
yint❌ No
widthint❌ No
heightint❌ No

Return Type: PyScrollArea


(graphic, x, y, hue) Create a gump pic(Use this for gump art, not item art) Example:

gumpPic = API.CreateGumpPic(0xafb)
gump.Add(gumpPic)
**Parameters:**
| Name | Type | Optional | Description |
| --- | --- | --- | --- |
| `graphic` | `ushort` | ❌ No | |
| `x` | `int` | ✅ Yes | |
| `y` | `int` | ✅ Yes | |
| `hue` | `ushort` | ✅ Yes | |
**Return Type:** `PyGumpPic`
---
### CreateDropDown
`(width, items, selectedIndex)`
Creates a dropdown control (combobox) with the specified width and items.
**Parameters:**
| Name | Type | Optional | Description |
| --- | --- | --- | --- |
| `width` | `int` | ❌ No | The width of the dropdown control |
| `items` | `string[]` | ❌ No | Array of strings to display as dropdown options |
| `selectedIndex` | `int` | ✅ Yes | The initially selected item index (default: 0) |
**Return Type:** `PyControlDropDown`
---
### AddControlOnClick
`(control, onClick, leftOnly)`
Add an onClick callback to a control.
Example:
```py
def myfunc:
API.SysMsg("Something clicked!")
bg = API.CreateGumpColorBox(0.7, "#D4202020")
API.AddControlOnClick(bg, myfunc)
while True:
API.ProcessCallbacks()

Parameters:

NameTypeOptionalDescription
controlobject❌ NoThe control listening for clicks
onClickobject❌ NoThe callback function
leftOnlybool✅ YesOnly accept left mouse clicks?

Return Type: object


(control, onDispose) Add onDispose(Closed) callback to a control. Example:

def onClose():
API.Stop()
gump = API.CreateGump()
gump.SetRect(100, 100, 200, 200)
bg = API.CreateGumpColorBox(opacity=0.7, color="#000000")
gump.Add(bg.SetRect(0, 0, 200, 200))
API.AddControlOnDisposed(gump, onClose)

Parameters:

NameTypeOptionalDescription
controlPyBaseControl❌ No
onDisposeobject❌ No

Return Type: PyBaseControl