Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packing Canvas Throws MethodError #154

Open
rteehas opened this issue Aug 18, 2020 · 2 comments
Open

Packing Canvas Throws MethodError #154

rteehas opened this issue Aug 18, 2020 · 2 comments

Comments

@rteehas
Copy link

rteehas commented Aug 18, 2020

I attempted to run the sketch_window() function in sketch.jl but when it evaluates the line that packs the canvas it throws the following:
ERROR: MethodError: pack(::Canvas) is ambiguous. Candidates: pack(c::Canvas, args...) in Tk at C:\Users\rteehan\.julia\packages\Tk\c8ZUf\src\tkwidget.jl:411 pack(widget::Union{AbstractString, Canvas, Tk.TkWidget, Tk_Widget}; kwargs...) in Tk at C:\Users\rteehan\.julia\packages\Tk\c8ZUf\src\containers.jl:117 Possible fix, define pack(::Canvas)

It seems like the example is failing because of an ambiguous overloaded function definition.

@aviks
Copy link
Collaborator

aviks commented Aug 20, 2020

Seems like a bug. I'll take a look.

@MommaWatasu
Copy link

I'm sorry suddenly.
I haven't seen all the code, but I think the following changes will fix it.
Erase the following part,

Tk.jl/src/tkwidget.jl

Lines 411 to 413 in 5d704d2

function pack(c::Canvas, args...)
pack(c.c, args...)
end

and here
pack(widget::Widget; kwargs...) = tcl("pack", widget; kwargs...)

How about changing it like this?

function pack(widget::Widget, kwargs...)
    if typeof(widget) == Canvas
        widget = widget.c
    end
    tcl("pack", widget; kwargs...)
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants