Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Segfault while (probably incorrectly) using Tkinter #122005

Open
Labels
topic-tkintertype-crashA hard crash of the interpreter, possibly with a core dump
@RLH-2110

Description

@RLH-2110

Crash report

What happened?

I am still learning python and then found out that this gives me a segmentation fault.

To reproduce, it should be enough to just run the python file. I commented what line leads to the segmentation fault.

I'm on an Ubuntu vm, used python 3.10, upgraded to 3.12 after I encountered the segfault.
tkinter version is 8.6

I attached the python file and the core dump, as well as the error file thing that Ubuntu creates instead of core dumps
I dont think I can be of much help with additional information, I know nothing.

importtkinterroot=tkinter.Tk()# Create a Canvas widget inside a Frame to hold your scrollable contentcanvas=tkinter.Canvas(root)scrollbar=tkinter.Scrollbar(root,orient="vertical",command=canvas.yview)rootS=tkinter.Frame(canvas)rootS.bind("<Configure>",lambdae:canvas.configure(scrollregion=canvas.bbox("all")    ))canvas.create_window((0,0),window=rootS,anchor="nw")canvas.configure(yscrollcommand=scrollbar.set)# Pack the scrollbar and canvasscrollbar.pack(side="right",fill="y")canvas.pack(side="left",fill="both",expand=True)defcenter_rootS(event):# Center the scrollable_frame within the canvasrootS.update_idletasks()canvas_width=canvas.winfo_width()canvas_height=canvas.winfo_height()scrollable_frame_width=rootS.winfo_reqwidth()scrollable_frame_height=rootS.winfo_reqheight()x_offset= (canvas_width-scrollable_frame_width)//2y_offset= (canvas_height-scrollable_frame_height)//2canvas.create_window((x_offset,y_offset),window=rootS,anchor="nw")# <---- this line creates a segfaultroot.bind("<Configure>",center_rootS)root.mainloop();

attachments.zip

CPython versions tested on:

3.10, 3.12

Operating systems tested on:

Linux

Output from running 'python -VV' on the command line:

Python 3.12.4 (main, Jul 18 2024, 13:27:24) [GCC 11.4.0]

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic-tkintertype-crashA hard crash of the interpreter, possibly with a core dump

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp