Skip to content

Commit 4b4a07b

Browse files
committed
Fix Python snippets in gui_system.md in order pass the test covered in cover-in-ci.lst.
1 parent 39fec0b commit 4b4a07b

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

docs/conftest.py

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
N = 16
4747
M = 8
4848
49+
gui = ti.GUI('Title', res=(400, 400))
4950
'''
5051

5152

docs/lang/articles/visualization/gui_system.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ Each window is built on a coordinate system: the origin is located in the lower-
4343
To display a Taichi field or a NumPy ndarray, call `gui.set_image()`. The method accepts both types as input.
4444

4545
```python
46+
gui = ti.GUI('Set Image', (640, 480))
4647
image = ti.Vector.field(3, ti.f32, shape=(640, 480))
4748
while gui.running:
4849
gui.set_image(image)
@@ -64,7 +65,7 @@ In each loop of the `gui.set_image()` method call, the GUI system converts the i
6465
If you only need to call the `set_image()` method without using any drawing command, you can enable `fast_gui` mode for better performance. This mode allows Taichi GUI to write the image data directly to the frame buffer without additional copying, and significantly increases FPS.
6566

6667
```python
67-
gui = ti.GUI(res, title, fast_gui=True)
68+
gui = ti.GUI('Fast GUI', res=(400, 400), fast_gui=True)
6869
```
6970

7071
For this mode to work, ensure that the data passed into `gui.set_image()` is in a display-compatible format. In other words, If it is a Taichi field, ensure that it is one of the following:
@@ -315,7 +316,6 @@ The following code defines that the `while` loop goes on until **ESC** is presse
315316
```python
316317
gui = ti.GUI('Title', (640, 480))
317318
while not gui.get_event(ti.GUI.ESCAPE):
318-
gui.set_image(img)
319319
gui.show()
320320
```
321321

0 commit comments

Comments
 (0)