tkinter listboxes with resizable columns - recursion fatal error
up vote
0
down vote
favorite
I'm using the .place
method. The following code is a working simplification of resizable columns and the error message which occurs while mouse-moving the columns after a short time.
import tkinter as tk
def column_drag(event):
#print(event.x)
for ii, i in enumerate(column_head):
if ii != 0:
currCur = root.winfo_pointerx() - root.winfo_rootx()
if currCur <= column_head[ii].winfo_x() + 10 and currCur >= column_head[ii].winfo_x() - 10:
if currCur <= column_head[ii].winfo_x() + 10 and currCur >= column_head[ii].winfo_x() - 10:
column_head[ii].configure(cursor="sb_h_double_arrow")
column_posx[ii] = currCur
column_user[ii] = True
refresh_run_display()
else: column_head[ii].configure(cursor="arrow")
def resize(event):
refresh_run_display()
def refresh_run_display():
ii = len(column_body)-1
for i in reversed(column_body):
# Last column
if ii+1 == len(column_body):
if column_user[ii] is False:
column_head[ii].place(x=ii * 150, y=0, height=20, width=root.winfo_width())
column_head[ii].update()
column_body[ii].place(x=ii * 150, y=column_head[ii].winfo_height(), height=120, width=root.winfo_width())
if column_user[ii] is True:
column_head[ii].place(x=column_posx[ii], y=0, height=20, width=root.winfo_width())
column_head[ii].update()
column_body[ii].place(x=column_posx[ii], y=column_head[ii].winfo_height(), height=120, width=root.winfo_width())
#middle column
if ii+1 != len(column_body) and ii != 0:
if column_user[ii] is False:
column_head[ii].place(x=ii * 150, y=0, height=20, width=column_head[ii+1].winfo_x())
column_head[ii].update()
column_body[ii].place(x=ii * 150, y=column_head[ii].winfo_height(), height=120, width=column_head[ii+1].winfo_x())
if column_user[ii] is True:
column_head[ii].place(x=column_posx[ii], y=0, height=20, width=column_head[ii+1].winfo_x())
column_head[ii].update()
column_body[ii].place(x=column_posx[ii], y=column_head[ii].winfo_height(), height=120, width=column_head[ii+1].winfo_x())
#first column
if ii == 0:
if column_user[ii] is False:
column_head[ii].place(x=1, y=0, height=20, width=column_head[ii+1].winfo_x())
column_head[ii].update()
column_body[ii].place(x=1, y=column_head[ii].winfo_height(), height=120, width=column_head[ii+1].winfo_x())
if column_user[ii] is True:
column_head[ii].place(x=1, y=0, height=20, width=column_head[ii+1].winfo_x())
column_head[ii].update()
column_body[ii].place(x=1, y=column_head[ii].winfo_height(), height=120, width=column_head[ii+1].winfo_x())
ii = ii - 1
root = tk.Tk()
gui_w = 650
gui_h = 270
gui_h_old = 0
x = (root.winfo_screenwidth()/2) - (gui_w/2)
y = (root.winfo_screenheight()/2) - (gui_h/2)
root.geometry('%dx%d+%d+%d' % (gui_w, gui_h, x, y))
root.bind('<Configure>', resize)
root.minsize(width=350, height=315)
root.maxsize(width=root.winfo_screenwidth(), height=root.winfo_screenheight())
column_names = ['id', 'name', 'size', 'time']
column_body = [tk.Listbox(borderwidth=0, highlightthickness=0, exportselection=0, activestyle='none') for i in column_names]
column_head = [tk.Button(text=i, borderwidth=0.5, relief="ridge", anchor="w") for i in column_names]
[i.bind("<Motion>", column_drag) for i in column_head]
column_lead = [False for i in column_names]; column_lead[0] = True
column_flip = [False for i in column_names]
column_user = [False for i in column_names]
column_posx = [0 for i in column_names]
root.mainloop()
Error message:
Fatal Python error: Cannot recover from stack overflow.
Current thread 0x00001440 (most recent call first):
File "C:python37libtkinter__init__.py", line 1704 in __call__
File "C:python37libtkinter__init__.py", line 1177 in update
File "path.../tst.py", line 42 in refresh_run_display
File "path.../tst.py", line 14 in column_drag
Process finished with exit code -1073740791 (0xC0000409)
I'd like to keep the current format if possible. Please help!
python python-3.x tkinter multiple-columns
add a comment |
up vote
0
down vote
favorite
I'm using the .place
method. The following code is a working simplification of resizable columns and the error message which occurs while mouse-moving the columns after a short time.
import tkinter as tk
def column_drag(event):
#print(event.x)
for ii, i in enumerate(column_head):
if ii != 0:
currCur = root.winfo_pointerx() - root.winfo_rootx()
if currCur <= column_head[ii].winfo_x() + 10 and currCur >= column_head[ii].winfo_x() - 10:
if currCur <= column_head[ii].winfo_x() + 10 and currCur >= column_head[ii].winfo_x() - 10:
column_head[ii].configure(cursor="sb_h_double_arrow")
column_posx[ii] = currCur
column_user[ii] = True
refresh_run_display()
else: column_head[ii].configure(cursor="arrow")
def resize(event):
refresh_run_display()
def refresh_run_display():
ii = len(column_body)-1
for i in reversed(column_body):
# Last column
if ii+1 == len(column_body):
if column_user[ii] is False:
column_head[ii].place(x=ii * 150, y=0, height=20, width=root.winfo_width())
column_head[ii].update()
column_body[ii].place(x=ii * 150, y=column_head[ii].winfo_height(), height=120, width=root.winfo_width())
if column_user[ii] is True:
column_head[ii].place(x=column_posx[ii], y=0, height=20, width=root.winfo_width())
column_head[ii].update()
column_body[ii].place(x=column_posx[ii], y=column_head[ii].winfo_height(), height=120, width=root.winfo_width())
#middle column
if ii+1 != len(column_body) and ii != 0:
if column_user[ii] is False:
column_head[ii].place(x=ii * 150, y=0, height=20, width=column_head[ii+1].winfo_x())
column_head[ii].update()
column_body[ii].place(x=ii * 150, y=column_head[ii].winfo_height(), height=120, width=column_head[ii+1].winfo_x())
if column_user[ii] is True:
column_head[ii].place(x=column_posx[ii], y=0, height=20, width=column_head[ii+1].winfo_x())
column_head[ii].update()
column_body[ii].place(x=column_posx[ii], y=column_head[ii].winfo_height(), height=120, width=column_head[ii+1].winfo_x())
#first column
if ii == 0:
if column_user[ii] is False:
column_head[ii].place(x=1, y=0, height=20, width=column_head[ii+1].winfo_x())
column_head[ii].update()
column_body[ii].place(x=1, y=column_head[ii].winfo_height(), height=120, width=column_head[ii+1].winfo_x())
if column_user[ii] is True:
column_head[ii].place(x=1, y=0, height=20, width=column_head[ii+1].winfo_x())
column_head[ii].update()
column_body[ii].place(x=1, y=column_head[ii].winfo_height(), height=120, width=column_head[ii+1].winfo_x())
ii = ii - 1
root = tk.Tk()
gui_w = 650
gui_h = 270
gui_h_old = 0
x = (root.winfo_screenwidth()/2) - (gui_w/2)
y = (root.winfo_screenheight()/2) - (gui_h/2)
root.geometry('%dx%d+%d+%d' % (gui_w, gui_h, x, y))
root.bind('<Configure>', resize)
root.minsize(width=350, height=315)
root.maxsize(width=root.winfo_screenwidth(), height=root.winfo_screenheight())
column_names = ['id', 'name', 'size', 'time']
column_body = [tk.Listbox(borderwidth=0, highlightthickness=0, exportselection=0, activestyle='none') for i in column_names]
column_head = [tk.Button(text=i, borderwidth=0.5, relief="ridge", anchor="w") for i in column_names]
[i.bind("<Motion>", column_drag) for i in column_head]
column_lead = [False for i in column_names]; column_lead[0] = True
column_flip = [False for i in column_names]
column_user = [False for i in column_names]
column_posx = [0 for i in column_names]
root.mainloop()
Error message:
Fatal Python error: Cannot recover from stack overflow.
Current thread 0x00001440 (most recent call first):
File "C:python37libtkinter__init__.py", line 1704 in __call__
File "C:python37libtkinter__init__.py", line 1177 in update
File "path.../tst.py", line 42 in refresh_run_display
File "path.../tst.py", line 14 in column_drag
Process finished with exit code -1073740791 (0xC0000409)
I'd like to keep the current format if possible. Please help!
python python-3.x tkinter multiple-columns
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm using the .place
method. The following code is a working simplification of resizable columns and the error message which occurs while mouse-moving the columns after a short time.
import tkinter as tk
def column_drag(event):
#print(event.x)
for ii, i in enumerate(column_head):
if ii != 0:
currCur = root.winfo_pointerx() - root.winfo_rootx()
if currCur <= column_head[ii].winfo_x() + 10 and currCur >= column_head[ii].winfo_x() - 10:
if currCur <= column_head[ii].winfo_x() + 10 and currCur >= column_head[ii].winfo_x() - 10:
column_head[ii].configure(cursor="sb_h_double_arrow")
column_posx[ii] = currCur
column_user[ii] = True
refresh_run_display()
else: column_head[ii].configure(cursor="arrow")
def resize(event):
refresh_run_display()
def refresh_run_display():
ii = len(column_body)-1
for i in reversed(column_body):
# Last column
if ii+1 == len(column_body):
if column_user[ii] is False:
column_head[ii].place(x=ii * 150, y=0, height=20, width=root.winfo_width())
column_head[ii].update()
column_body[ii].place(x=ii * 150, y=column_head[ii].winfo_height(), height=120, width=root.winfo_width())
if column_user[ii] is True:
column_head[ii].place(x=column_posx[ii], y=0, height=20, width=root.winfo_width())
column_head[ii].update()
column_body[ii].place(x=column_posx[ii], y=column_head[ii].winfo_height(), height=120, width=root.winfo_width())
#middle column
if ii+1 != len(column_body) and ii != 0:
if column_user[ii] is False:
column_head[ii].place(x=ii * 150, y=0, height=20, width=column_head[ii+1].winfo_x())
column_head[ii].update()
column_body[ii].place(x=ii * 150, y=column_head[ii].winfo_height(), height=120, width=column_head[ii+1].winfo_x())
if column_user[ii] is True:
column_head[ii].place(x=column_posx[ii], y=0, height=20, width=column_head[ii+1].winfo_x())
column_head[ii].update()
column_body[ii].place(x=column_posx[ii], y=column_head[ii].winfo_height(), height=120, width=column_head[ii+1].winfo_x())
#first column
if ii == 0:
if column_user[ii] is False:
column_head[ii].place(x=1, y=0, height=20, width=column_head[ii+1].winfo_x())
column_head[ii].update()
column_body[ii].place(x=1, y=column_head[ii].winfo_height(), height=120, width=column_head[ii+1].winfo_x())
if column_user[ii] is True:
column_head[ii].place(x=1, y=0, height=20, width=column_head[ii+1].winfo_x())
column_head[ii].update()
column_body[ii].place(x=1, y=column_head[ii].winfo_height(), height=120, width=column_head[ii+1].winfo_x())
ii = ii - 1
root = tk.Tk()
gui_w = 650
gui_h = 270
gui_h_old = 0
x = (root.winfo_screenwidth()/2) - (gui_w/2)
y = (root.winfo_screenheight()/2) - (gui_h/2)
root.geometry('%dx%d+%d+%d' % (gui_w, gui_h, x, y))
root.bind('<Configure>', resize)
root.minsize(width=350, height=315)
root.maxsize(width=root.winfo_screenwidth(), height=root.winfo_screenheight())
column_names = ['id', 'name', 'size', 'time']
column_body = [tk.Listbox(borderwidth=0, highlightthickness=0, exportselection=0, activestyle='none') for i in column_names]
column_head = [tk.Button(text=i, borderwidth=0.5, relief="ridge", anchor="w") for i in column_names]
[i.bind("<Motion>", column_drag) for i in column_head]
column_lead = [False for i in column_names]; column_lead[0] = True
column_flip = [False for i in column_names]
column_user = [False for i in column_names]
column_posx = [0 for i in column_names]
root.mainloop()
Error message:
Fatal Python error: Cannot recover from stack overflow.
Current thread 0x00001440 (most recent call first):
File "C:python37libtkinter__init__.py", line 1704 in __call__
File "C:python37libtkinter__init__.py", line 1177 in update
File "path.../tst.py", line 42 in refresh_run_display
File "path.../tst.py", line 14 in column_drag
Process finished with exit code -1073740791 (0xC0000409)
I'd like to keep the current format if possible. Please help!
python python-3.x tkinter multiple-columns
I'm using the .place
method. The following code is a working simplification of resizable columns and the error message which occurs while mouse-moving the columns after a short time.
import tkinter as tk
def column_drag(event):
#print(event.x)
for ii, i in enumerate(column_head):
if ii != 0:
currCur = root.winfo_pointerx() - root.winfo_rootx()
if currCur <= column_head[ii].winfo_x() + 10 and currCur >= column_head[ii].winfo_x() - 10:
if currCur <= column_head[ii].winfo_x() + 10 and currCur >= column_head[ii].winfo_x() - 10:
column_head[ii].configure(cursor="sb_h_double_arrow")
column_posx[ii] = currCur
column_user[ii] = True
refresh_run_display()
else: column_head[ii].configure(cursor="arrow")
def resize(event):
refresh_run_display()
def refresh_run_display():
ii = len(column_body)-1
for i in reversed(column_body):
# Last column
if ii+1 == len(column_body):
if column_user[ii] is False:
column_head[ii].place(x=ii * 150, y=0, height=20, width=root.winfo_width())
column_head[ii].update()
column_body[ii].place(x=ii * 150, y=column_head[ii].winfo_height(), height=120, width=root.winfo_width())
if column_user[ii] is True:
column_head[ii].place(x=column_posx[ii], y=0, height=20, width=root.winfo_width())
column_head[ii].update()
column_body[ii].place(x=column_posx[ii], y=column_head[ii].winfo_height(), height=120, width=root.winfo_width())
#middle column
if ii+1 != len(column_body) and ii != 0:
if column_user[ii] is False:
column_head[ii].place(x=ii * 150, y=0, height=20, width=column_head[ii+1].winfo_x())
column_head[ii].update()
column_body[ii].place(x=ii * 150, y=column_head[ii].winfo_height(), height=120, width=column_head[ii+1].winfo_x())
if column_user[ii] is True:
column_head[ii].place(x=column_posx[ii], y=0, height=20, width=column_head[ii+1].winfo_x())
column_head[ii].update()
column_body[ii].place(x=column_posx[ii], y=column_head[ii].winfo_height(), height=120, width=column_head[ii+1].winfo_x())
#first column
if ii == 0:
if column_user[ii] is False:
column_head[ii].place(x=1, y=0, height=20, width=column_head[ii+1].winfo_x())
column_head[ii].update()
column_body[ii].place(x=1, y=column_head[ii].winfo_height(), height=120, width=column_head[ii+1].winfo_x())
if column_user[ii] is True:
column_head[ii].place(x=1, y=0, height=20, width=column_head[ii+1].winfo_x())
column_head[ii].update()
column_body[ii].place(x=1, y=column_head[ii].winfo_height(), height=120, width=column_head[ii+1].winfo_x())
ii = ii - 1
root = tk.Tk()
gui_w = 650
gui_h = 270
gui_h_old = 0
x = (root.winfo_screenwidth()/2) - (gui_w/2)
y = (root.winfo_screenheight()/2) - (gui_h/2)
root.geometry('%dx%d+%d+%d' % (gui_w, gui_h, x, y))
root.bind('<Configure>', resize)
root.minsize(width=350, height=315)
root.maxsize(width=root.winfo_screenwidth(), height=root.winfo_screenheight())
column_names = ['id', 'name', 'size', 'time']
column_body = [tk.Listbox(borderwidth=0, highlightthickness=0, exportselection=0, activestyle='none') for i in column_names]
column_head = [tk.Button(text=i, borderwidth=0.5, relief="ridge", anchor="w") for i in column_names]
[i.bind("<Motion>", column_drag) for i in column_head]
column_lead = [False for i in column_names]; column_lead[0] = True
column_flip = [False for i in column_names]
column_user = [False for i in column_names]
column_posx = [0 for i in column_names]
root.mainloop()
Error message:
Fatal Python error: Cannot recover from stack overflow.
Current thread 0x00001440 (most recent call first):
File "C:python37libtkinter__init__.py", line 1704 in __call__
File "C:python37libtkinter__init__.py", line 1177 in update
File "path.../tst.py", line 42 in refresh_run_display
File "path.../tst.py", line 14 in column_drag
Process finished with exit code -1073740791 (0xC0000409)
I'd like to keep the current format if possible. Please help!
python python-3.x tkinter multiple-columns
python python-3.x tkinter multiple-columns
asked Nov 10 at 19:01
Rhys
1,663122746
1,663122746
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
I think the column_head[ii].update()
is causing this error.
Before, In testing column_head[ii].winfo_height()
would return an incorrect value when asked to return its value in the next line:
column_head[ii].place(x=ii * 150, y=0, height=20, width=root.winfo_width())
column_head[ii].update()
solved this but apparently now it is not necessary and commenting out all column_head[ii].update()
seems to have worked. It was the line called out in the debug
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
I think the column_head[ii].update()
is causing this error.
Before, In testing column_head[ii].winfo_height()
would return an incorrect value when asked to return its value in the next line:
column_head[ii].place(x=ii * 150, y=0, height=20, width=root.winfo_width())
column_head[ii].update()
solved this but apparently now it is not necessary and commenting out all column_head[ii].update()
seems to have worked. It was the line called out in the debug
add a comment |
up vote
0
down vote
I think the column_head[ii].update()
is causing this error.
Before, In testing column_head[ii].winfo_height()
would return an incorrect value when asked to return its value in the next line:
column_head[ii].place(x=ii * 150, y=0, height=20, width=root.winfo_width())
column_head[ii].update()
solved this but apparently now it is not necessary and commenting out all column_head[ii].update()
seems to have worked. It was the line called out in the debug
add a comment |
up vote
0
down vote
up vote
0
down vote
I think the column_head[ii].update()
is causing this error.
Before, In testing column_head[ii].winfo_height()
would return an incorrect value when asked to return its value in the next line:
column_head[ii].place(x=ii * 150, y=0, height=20, width=root.winfo_width())
column_head[ii].update()
solved this but apparently now it is not necessary and commenting out all column_head[ii].update()
seems to have worked. It was the line called out in the debug
I think the column_head[ii].update()
is causing this error.
Before, In testing column_head[ii].winfo_height()
would return an incorrect value when asked to return its value in the next line:
column_head[ii].place(x=ii * 150, y=0, height=20, width=root.winfo_width())
column_head[ii].update()
solved this but apparently now it is not necessary and commenting out all column_head[ii].update()
seems to have worked. It was the line called out in the debug
edited Nov 11 at 0:06
answered Nov 10 at 23:19
Rhys
1,663122746
1,663122746
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53242414%2ftkinter-listboxes-with-resizable-columns-recursion-fatal-error%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown