0

I want to create a window in which to save and open a file in the menu bar, but it does not work

https://code.sololearn.com/cA58A7A203A2/?ref=app

11th Feb 2021, 9:54 PM
mar ia
mar ia - avatar
6 odpowiedzi
+ 3
It does not work because you do not pass the function by reference: fichier.add_command(label="Open",command=op()) You must spend the function like that: fichier.add_command(label="Open",command=op) The difference is: 1-command=op())#return none 2-command=op)#return function The first only activates the function and Return null. But the second passes the address of memory and therefore passes the function itself instead of calling it: This would be all: https://code.sololearn.com/c9tmTRtVpFnw/?ref=app
12th Feb 2021, 1:28 AM
Daniel Briceño
Daniel Briceño - avatar
+ 2
Me gusta tu codigo :)#español I like your code.;)#english
12th Feb 2021, 1:39 AM
Daniel Briceño
Daniel Briceño - avatar
0
thank you 😊
12th Feb 2021, 6:24 AM
mar ia
mar ia - avatar
0
how can i do to wen i click in "afichage" it is open a photo
12th Feb 2021, 6:38 AM
mar ia
mar ia - avatar
0
I can not help you with the photos, because I do not know much about Tkinter. But with the command yes I can, instead of using the function add_cascade(); Use the function add_command(); To the menu bar and so I added functionality. The add_cascade () function; what it does is a drop-down menu, but the Add_Command () function; What it does is create a button in the menu bar.
12th Feb 2021, 12:00 PM
Daniel Briceño
Daniel Briceño - avatar
0
oh ak thanks
12th Feb 2021, 12:27 PM
mar ia
mar ia - avatar