mirror of
https://github.com/Taiko2k/GTK4PythonTutorial.git
synced 2025-07-21 20:51:10 +02:00
Replace dw with self.dw in Cairo introduction because self.dw is needed in the following section
This commit is contained in:
14
README.md
14
README.md
@@ -414,18 +414,18 @@ To draw with Cairo we use the [***DrawingArea***](https://docs.gtk.org/gtk4/clas
|
||||
|
||||
```python
|
||||
|
||||
dw = Gtk.DrawingArea()
|
||||
self.dw = Gtk.DrawingArea()
|
||||
|
||||
# Make it fill the available space (It will stretch with the window)
|
||||
dw.set_hexpand(True)
|
||||
dw.set_vexpand(True)
|
||||
self.dw.set_hexpand(True)
|
||||
self.dw.set_vexpand(True)
|
||||
|
||||
# Instead, If we didn't want it to fill the available space but wanted a fixed size
|
||||
#dw.set_content_width(100)
|
||||
#dw.set_content_height(100)
|
||||
#self.dw.set_content_width(100)
|
||||
#self.dw.set_content_height(100)
|
||||
|
||||
dw.set_draw_func(self.draw, None)
|
||||
self.box3.append(dw)
|
||||
self.dw.set_draw_func(self.draw, None)
|
||||
self.box3.append(self.dw)
|
||||
|
||||
def draw(self, area, c, w, h, data):
|
||||
# c is a Cairo context
|
||||
|
Reference in New Issue
Block a user