You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17-2Lines changed: 17 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,12 @@
2
2
3
3
Flake8 plugin to detect (too) common mistakes and bad practices in Tkinter projects
4
4
5
+
## Installation
6
+
7
+
```
8
+
pip install flake8-tkinter
9
+
```
10
+
5
11
6
12
## List of warnings
7
13
@@ -32,6 +38,15 @@ Calling a function with arguments instead of using a lambda or a partial functio
32
38
+ ttk.Button(command=lambda: foo(bar, baz))
33
39
```
34
40
41
+
### `TK131`
42
+
Don't assign to `w.grid()` / `w.pack()` / `w.place()`, it's return value is `None`
43
+
44
+
```diff
45
+
- btn = ttk.Button().grid()
46
+
+ btn = ttk.Button()
47
+
+ btn.grid()
48
+
```
49
+
35
50
### `TK201`
36
51
Don't use `from tkinter import *`
37
52
@@ -113,7 +128,7 @@ Don't use things like `add="+"`. Use a boolean instead
113
128
## More planned warnings
114
129
115
130
- Common mistakes
116
-
-[] Warn when assigning to result of `w.pack()` | `w.grid()` | `w.place()` call (`None`) (**TK131**)
131
+
-[x] Warn when assigning to result of `w.pack()` | `w.grid()` | `w.place()` call (`None`) (**TK131**)
117
132
-[ ] Warn when using more than one`Tk` instance: child windows must be created from `Toplevel` class (**TK101**)
118
133
-[x] Warn when using more than one `mainloop()` call (**TK102**)
119
134
-[ ] Suggest using `w.after(ms)` instead of `time.sleep(s)` (**TK121**)
@@ -136,7 +151,7 @@ Don't use things like `add="+"`. Use a boolean instead
136
151
-[x] Warn when using `tag_bind` inside a loop, but not storing the Tcl command (can cause memory leaks later) (**TK232**)
137
152
138
153
- Opinionated suggestions
139
-
-[ ] Suggest changing things like `root.wm_title()` to `root.title()` (tho I use `wm_` quite often) (**TK305**)
154
+
-[ ] Suggest changing things like `root.wm_title()` to `root.title()` (tho I use `wm_attributes` quite often, probably that should be an exception) (**TK305**)
140
155
-[ ] Warn when calling `mainloop()` on something other than the root window (**TK303**)
141
156
-[ ] Suggest using more clear binding sequences, like `<Button-1>` instead of `<1>` and `<Key-a>` instead of `<a>` (**TK301**)
142
157
-[ ] Warn if a parent is not specified (?) (**TK306**)
0 commit comments