mirror of
https://github.com/Taiko2k/GTK4PythonTutorial.git
synced 2026-11-10 06:40:09 +01:00
Replace dw with self.dw in Cairo introduction because self.dw is needed in the following section
This commit is contained in:
1 parent
f130a1f948
commit
1727c88c18
1 file changed
+7
-7
@@ -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