Menu Bars With tKinter - Python Tkinter GUI Tutorial #46

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 ต.ค. 2024

ความคิดเห็น • 199

  • @mihaiopricescu211
    @mihaiopricescu211 4 ปีที่แล้ว +27

    Thank you for the series of these tutorials. I discovered after I saw your video that I like to use the "tearoff" option to not have the "-------------" at the beginning of the menu. Without this, if you click on it it will open actually the menu in a new window.

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว +5

      Nice

    • @hectorgomez28
      @hectorgomez28 4 ปีที่แล้ว +18

      file_menu = Menu(my_menu, tearoff=0)

    • @ame367
      @ame367 4 ปีที่แล้ว +2

      @@hectorgomez28 thanks :)

    • @jorgeachar8320
      @jorgeachar8320 4 ปีที่แล้ว +1

      I appreciate it :)

    • @Discodave676
      @Discodave676 3 ปีที่แล้ว +1

      @@hectorgomez28 This is what we need! Thanks!

  • @markjocelyn5132
    @markjocelyn5132 4 ปีที่แล้ว +5

    Thank you for demystifying Python GUI in this series of lessons. I battled getting my mind around visual basic decades ago and gave up the idea of trying anything with a GUI. This and your lessons on using databases with tkinter you have posted on TH-cam has been a real pleasure to follow. You really should add these series to your academy even if you just link to the TH-cam videos as this lessons are what i signed up with you for and I do feel it adds extra value and your efforts has made becoming a client of yours worth the investment.

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว

      My Codemy.com website has a tkinter course with 50+ videos. These youtube videos here on youtube that you mention are...well...here on youtube. Anyone with a codemy membership can watch them here anytime they want. The link to the playlist is in the comment section of every video.

  • @saganasimov4891
    @saganasimov4891 4 ปีที่แล้ว +15

    Thank you very for these video tutorials, it really saves me time in searching in the internet and I really appreciate it.

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว +5

      You're very welcome!

  • @rabiumuhammedeffect423
    @rabiumuhammedeffect423 2 ปีที่แล้ว

    we will one day reference our carrier to this great man!!!. A BIG THANKS FROM THIS SIDE "JOHN". my name is Muhammed from Ghana.

  • @EFoxVN
    @EFoxVN ปีที่แล้ว

    Thanks so much John, I just LOVE your videos. Please know that your efforts are much appreciated from all over the world. Blessings

    • @Codemycom
      @Codemycom  ปีที่แล้ว

      I appreciate it!

  • @kutup1763
    @kutup1763 ปีที่แล้ว +1

    How can I delete the sentences after I select my options?
    I mean how I delete Friday text after I select Monday

  • @sameehazahid466
    @sameehazahid466 ปีที่แล้ว +1

    mine says 'unknown option -Label'
    Why?

  • @KadeMccarroll
    @KadeMccarroll ปีที่แล้ว +1

    Hey, I just have a question about python Tkinter. If I made a button in Tkinter where text appears on the screen when the button was clicked how do I make it so that when I run my code and press the button the text stays there when I close the program and re run it?

    • @Codemycom
      @Codemycom  ปีที่แล้ว +1

      You don't, unless you save that state to a database or something...or a text file or something.

    • @KadeMccarroll
      @KadeMccarroll ปีที่แล้ว

      @@Codemycom Okay thank you, do you have a video on how to save it to a text file or database?

    • @Codemycom
      @Codemycom  ปีที่แล้ว +1

      @@KadeMccarroll Sure, lots...check the playlist

  • @fvefa
    @fvefa 4 ปีที่แล้ว

    Your videos are very helpfull and easy to understand

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว

      Thanks! Glad you like them!

  • @Codemycom
    @Codemycom  4 ปีที่แล้ว +1

    ▶️ Watch Entire Tkinter Playlist ✅ Subscribe To My TH-cam Channel:
    bit.ly/2UFLKgj bit.ly/2IGzvOR
    ▶️ See More At: ✅ Join My Facebook Group:
    Codemy.com bit.ly/2GFmOBz
    ▶️ Learn to Code at Codemy.com ✅ Buy a Codemy T-Shirt!
    Take $30 off with coupon code: youtube1 bit.ly/2VC9WUN

  • @gisellgonzalezrodriguez1162
    @gisellgonzalezrodriguez1162 2 ปีที่แล้ว

    I LOVE this channel.

    • @Codemycom
      @Codemycom  2 ปีที่แล้ว

      I love to hear it!

  • @RajuSinghp3ntester
    @RajuSinghp3ntester 3 ปีที่แล้ว

    @codemy Icon doesn't work when we build the app with pyinstaller and ship to another system

  • @jokywood1489
    @jokywood1489 4 หลายเดือนก่อน

    sir we used functions like main_menu.add_cascade(label = 'some text', menu = file_manu)
    i want to know the source code of these functions that how the functions like add_cascade(), Menu() etc are developed.
    these functions are inbuilt and i want to know how these functions have been created.
    Please sir explain, pleas sir

  • @poparab
    @poparab 2 ปีที่แล้ว

    small Question:
    Can we read an Array from Javascript generated (in the Memory) (RAM) and read with python. Python was the wonder magic all inkl. Language. So I think this can gone work.

  • @AnujKumar-xn5tg
    @AnujKumar-xn5tg 4 ปีที่แล้ว +2

    Sir, can we remove that dotted line? when we click that it separate out of the Menu
    Its look like a separator above New and Edit.

  • @stevecavell1943
    @stevecavell1943 3 ปีที่แล้ว +1

    Love your videos. I was following this tutorial and could not work out why it was "not working" for ages. Turns out if you are on a Mac it IS working but the menu bar is placed at the top of the screen not in the working window!

    • @Codemycom
      @Codemycom  3 ปีที่แล้ว +1

      yep!

    • @bowenliu4100
      @bowenliu4100 2 ปีที่แล้ว

      thanks so much! I was so confused lol

  • @davoodbarzegari4080
    @davoodbarzegari4080 ปีที่แล้ว

    thank you, sir.
    what is the software you are using to write the code? I use IDLE but it is not so user friendly.

    • @Codemycom
      @Codemycom  ปีที่แล้ว

      Sublime Text and the Git Bash terminal...never use IDLE for anything :-p

  • @madaniselilih331
    @madaniselilih331 2 ปีที่แล้ว

    Thank you for this great explanation, but I have a question how to make the menu from right to left for Arabic.

    • @Codemycom
      @Codemycom  2 ปีที่แล้ว

      Sorry, no clue

  • @MSTSLive
    @MSTSLive 8 หลายเดือนก่อน +1

    sir can you please tell me how i can also add it in customtkinter

    • @Codemycom
      @Codemycom  8 หลายเดือนก่อน

      I have an entire customtkinter playlist over on the tkinter.com TH-cam channel.

  • @shrinidhimohandeshpande656
    @shrinidhimohandeshpande656 4 ปีที่แล้ว +1

    Thank you for the very informative tutorial.
    Can you please educate me on changing the background color of the title / menu bar. ?
    Thank-you.

  • @howimetstarwars356
    @howimetstarwars356 3 ปีที่แล้ว

    Hello tahnk u ! I am asking than. How can i use link with menu bar ?

  • @tylergamer5276
    @tylergamer5276 2 ปีที่แล้ว

    I got question, how do u remove the fact if u click on the "-------------" at the top of the drop box of a menu, it pops that menu out, how do u stop this from happening??

    • @Codemycom
      @Codemycom  2 ปีที่แล้ว

      You can remove that bar...I have videos on that in the playlist somewhere

    • @MelodyandInspiration
      @MelodyandInspiration ปีที่แล้ว +1

      file_menu = Menu(my_menu, tearoff=False)

  • @lilytucker2464
    @lilytucker2464 ปีที่แล้ว

    Hello, thanks so much for your tutorials - but, I have a question, why do some teachers, such as yourself, start with "root = Tk()" and others start with "main_window = Tk()"? What is the difference and can I add the "root" at the beginning of my code or do I have to redo all of my work? Please and thanks...

    • @Codemycom
      @Codemycom  ปีที่แล้ว

      They're both the same, you can call a variable anything you want. root is short and universal. but you could call it happy_bob if you want, it doesn't matter, you just have to use that throughout the entire app.

    • @lilytucker2464
      @lilytucker2464 ปีที่แล้ว

      @@Codemycom Awesome! Thanks again!! I guess I thought it a command rather than a variable, so I'm glad to understand it now. Maybe it was mentioned somewhere along the line and I missed it, so I appreciate you explaining it. 😊

  • @marisasharma1411
    @marisasharma1411 4 ปีที่แล้ว

    Looks cool! I love your edit :)

  • @terfer9128
    @terfer9128 4 ปีที่แล้ว +1

    I was waiting for this to upgrade my simple calculator and I really wanna add a lot of thing but i don’t already know what to do please add a vid named upgrating the calculator please answer me !

  • @jesterlw
    @jesterlw 4 ปีที่แล้ว

    Excellent video and very understandable.

  • @heshankumarasinghe3159
    @heshankumarasinghe3159 4 ปีที่แล้ว

    Thank you.... This video is helpful.....

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว +1

      Glad it was helpful!

  • @JeffBurow
    @JeffBurow 3 ปีที่แล้ว

    Your content is awesome and has really helped me learn tkinter and python to a degree of some effectiveness. I am working on a small GUI. It is being displayed on a 7" HDMI screen connected to a Pi4. To maximize my real estate, I would like to slide/collapse the menu bar out of the way and hide it. I have not been able to find anything anywhere on how to do this without manually creating an entire menubar. Is this possible? If not, I will use tkinter's menu system rather than build it from scratch for this project.

    • @Codemycom
      @Codemycom  3 ปีที่แล้ว +1

      No, there's no built in thing for that...you'll have to hack it together yourself

  • @MickForjay
    @MickForjay 9 หลายเดือนก่อน

    how do you get rid of the dashed lines that appear above the menu items?

    • @Codemycom
      @Codemycom  9 หลายเดือนก่อน

      tearoff=0 (or maybe 1 I can;t recall)

    • @MickForjay
      @MickForjay 9 หลายเดือนก่อน

      @@Codemycom thank you

    • @Codemycom
      @Codemycom  9 หลายเดือนก่อน

      welcome@@MickForjay

  • @sayedbalal541
    @sayedbalal541 3 ปีที่แล้ว

    how to change the menu size and height?

  • @kamiftc5598
    @kamiftc5598 ปีที่แล้ว

    what do i need to put for root.iconbitmap, just asking and have no clue

    • @Codemycom
      @Codemycom  ปีที่แล้ว

      That's the icon that goes on the top menu bar of the app

  • @abteyeb7969
    @abteyeb7969 2 ปีที่แล้ว

    Thank you very for all

    • @Codemycom
      @Codemycom  2 ปีที่แล้ว

      Thanks for watching!

  • @judeleon8485
    @judeleon8485 4 ปีที่แล้ว

    Thanks a million for this video. However, is it possible to have menu bar inside a frame or notebook, instead of having it in the root window? If it is possible, can you please let us know how.

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว

      Not sure what you mean, but you can have drop down menus in those places.

    • @judeleon8485
      @judeleon8485 4 ปีที่แล้ว

      Well, I am not talking about dropdown as in optionmenu. I mean creating menu widget in a frame as file_menu = menu(frame). In your video you placed the menu bar on the root window as file_menu=menu(root). I tried it by replacing the root with a frame widget and got an error

  • @navneetyadav8869
    @navneetyadav8869 4 ปีที่แล้ว +1

    Sir could u send the code in the description,I was having problem with the program ,so I'll be able to copy paste the code

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว +4

      My code is here: github.com/flatplanet/Intro-To-TKinter-TH-cam-Course
      But you shouldn't need to copy and paste code. Rewatch the video and work it out man.

    • @navneetyadav8869
      @navneetyadav8869 4 ปีที่แล้ว

      @@Codemycom hmm just will check out the difference

  • @pverprogramz641
    @pverprogramz641 4 ปีที่แล้ว

    sir, is it possible to delete a menu item when clicking a button ??
    Like menu.delete_cascade() or something like that

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว

      I'm sure there is, but I don't think I've ever tried it :-p

    • @pverprogramz641
      @pverprogramz641 4 ปีที่แล้ว

      @@Codemycom I think you should try that . 😜

  • @mryotzin
    @mryotzin 4 ปีที่แล้ว

    great video !
    it helps me a lot !

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว

      Glad to hear that!

  • @namanallawadhi7397
    @namanallawadhi7397 3 ปีที่แล้ว

    thank you Heisenberg :)

    • @Codemycom
      @Codemycom  3 ปีที่แล้ว

      My pleasure!

  • @Zhisaoka
    @Zhisaoka 4 ปีที่แล้ว

    I am trying to make a menu that opens a python file, I am quite into the video and my code will not work, its almost the same but it still won't work. It just will show a blank gui with a title, Code:
    Edit: Nvm on mac it just looks diffrent
    from tkinter import *
    root = Tk()
    root.title("Techno Play Menu")
    root.geometry("400x400")
    my_menu = Menu(root)
    root.config(menu=my_menu)
    def command():
    pass
    file_menu = Menu(my_menu)
    my_menu.add_cascade(label="File", menu=file_menu)
    file_menu.add_command(label="New...", command=command)
    file_menu.add_command(label="Exit", command=root.quit)
    root.mainloop()

  • @karthikeeyan1653
    @karthikeeyan1653 4 ปีที่แล้ว

    Can u tell how to increse the font size of words in the menu bar like file,edit..

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว +1

      You can't.

  • @hamadc.2966
    @hamadc.2966 4 ปีที่แล้ว +1

    Hi! Thank you sooo much for these tutorials
    I've copied your code exactly but when its time to compile, there's an error:
    _tkinter.TclError: unknown option "-menu"
    this is on the root.config(menu = root)
    How do I fix this???

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว +2

      Every time someone says that they copied the code exactly but there was an error...they didn't copy the code exactly. Check for typos.

    • @jesterlw
      @jesterlw 4 ปีที่แล้ว +1

      The error you got was from capitalizing the L in label.

    • @vivek254258
      @vivek254258 4 ปีที่แล้ว +1

      @@jesterlw I got the same problem with my program,thanks for showing me the solution

    • @ferdindonbosco246
      @ferdindonbosco246 4 ปีที่แล้ว

      @@Codemycom Lol...seems like you get that a lot!! I can sense the frustration 😉

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว

      @@ferdindonbosco246 You have no idea LOL

  • @jtwnow4342
    @jtwnow4342 3 ปีที่แล้ว

    When add menu bar it will not open middle in the screen...please help me

    • @Codemycom
      @Codemycom  3 ปีที่แล้ว +1

      check your code for typos

  • @benjaminnicholls5405
    @benjaminnicholls5405 4 ปีที่แล้ว

    Should it work if I place the menu inside of a frame?

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว

      Try it and see

  • @TaxManianDevil
    @TaxManianDevil ปีที่แล้ว

    Does this work the same with customtkinter?

    • @Codemycom
      @Codemycom  ปีที่แล้ว

      nothing works quite the same with customtkinter

  • @binkyslife
    @binkyslife ปีที่แล้ว

    Thank you!

  • @RyanDanielG
    @RyanDanielG 3 ปีที่แล้ว

    feed the algorithm! great vid!

  • @ClusterSeries
    @ClusterSeries 4 ปีที่แล้ว +1

    Sir, Can you please make a video on pyperclip module ?.

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว

      Sorry, I'm not familiar with that

  • @dragoneater2008_
    @dragoneater2008_ 3 ปีที่แล้ว

    Can I replace the menu with a button? If so how?

    • @Codemycom
      @Codemycom  3 ปีที่แล้ว

      Sure, in the normal way you would use any button.

  • @NEXC
    @NEXC 3 ปีที่แล้ว +1

    To everyone having errors please check your spelling for 'label'

    • @Codemycom
      @Codemycom  3 ปีที่แล้ว +1

      it's usually a typo yes

    • @gacem213
      @gacem213 2 ปีที่แล้ว +1

      ur comment helped thanks a lot, I thought the l was capital because of the font

    • @NEXC
      @NEXC 2 ปีที่แล้ว

      @@gacem213 :D

  • @supersonic6734
    @supersonic6734 3 ปีที่แล้ว

    Can I cascade a Menu to a label frame instead of root?

    • @Codemycom
      @Codemycom  3 ปีที่แล้ว

      Try it and see

    • @supersonic6734
      @supersonic6734 3 ปีที่แล้ว

      @@Codemycom I did try before I posted the comment. I did try it again as you said. First it did not work. Labelframe.config(menu=my_menu) did not work. But root.config(menu=my_menu) worked.

  • @gamepunk7963
    @gamepunk7963 3 ปีที่แล้ว

    Umm there’s something wrong with pycharm it does not recognize label but
    Tkinter recognized Label before...,why is it doing that

    • @Codemycom
      @Codemycom  3 ปีที่แล้ว

      No idea, I would never use Pycharm, it's terrible

    • @RyanDanielG
      @RyanDanielG 3 ปีที่แล้ว

      for future questioners: lower case 'label'

  • @awhlox9099
    @awhlox9099 4 ปีที่แล้ว

    I can already code in python what else should I learn to code ? What’s do you recommend to create things

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว

      Depends entirely on the type of things you want to create...

    • @awhlox9099
      @awhlox9099 4 ปีที่แล้ว

      Codemy.com what’s the best language to learn overall instead of python

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว

      @@awhlox9099 Depends entirely on what you're trying to do...best for what? Building websites? Designing Games? Doing Big Data? Running Server? See what I mean?

    • @awhlox9099
      @awhlox9099 4 ปีที่แล้ว

      Codemy.com yes. But what language should I learn next I’ve learned python and now what other languages are fun

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว

      @@awhlox9099 I've already answered you...it depends. period. What do you want to do? Build websites? Build games? Do big data? It depends dude. I can't explain it any other way. lol What language you learn next will be determined wholly by what you want to do with it. And anyway, they're all fun...

  • @summaalchemica364
    @summaalchemica364 ปีที่แล้ว

    awesome, thanks!

  • @Abdulaziz-e-2030
    @Abdulaziz-e-2030 3 ปีที่แล้ว

    hello teacher I did same you write but the eror is (( self.tk.call((self._w, 'add', itemType) +
    _tkinter.TclError: unknown option "-Label")). iam using Mac the same code I did is same what you did could you help pls

    • @Abdulaziz-e-2030
      @Abdulaziz-e-2030 3 ปีที่แล้ว

      your code = my code that is why I could not understand whats wrong

    • @Codemycom
      @Codemycom  3 ปีที่แล้ว

      No, my code does not equal your code...you have a typo someone. If they equaled, you wouldn't have an error.

    • @Abdulaziz-e-2030
      @Abdulaziz-e-2030 3 ปีที่แล้ว

      @@Codemycom if you can help😊😁
      I would to send all the code if you can check
      I wached all the previous 45 lessons i dont want to jump th 46th

    • @Codemycom
      @Codemycom  3 ปีที่แล้ว

      @@Abdulaziz-e-2030 No sorry, but the error is telling you what the problem is. You've used Label incorrectly somewhere.

    • @Abdulaziz-e-2030
      @Abdulaziz-e-2030 3 ปีที่แล้ว

      @@Codemycom teacher pls see my code on twitter I am sure no mistakes with (Label).
      twitter.com/abdoh69424/status/1339420201574690818?s=21

  • @Spasmaticus
    @Spasmaticus 4 ปีที่แล้ว

    Do I have to use "root"? I'm currently using "window" instead and i'm getting some errors.
    "my_menu = Menu(window)
    NameError: name 'Menu' is not defined"
    This is my code:
    import tkinter as tk
    import tkinter.messagebox
    window = tk.Tk()
    [....]
    def testFunc():
    pass
    # The menu
    my_menu = Menu(window)
    window.config(menu=my_menu)
    # The menu items
    file_menu = tk.Menu(my_menu)
    my_menu.add_cascade(Label="File", menu=file_menu)
    file_menu.add_command(Label="New", command=testFunc)
    file_meny.add_command(Label="Exit", command=testFunc)

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว +1

      If you use window, you would use window, not root...but hey, if you don't know what you're doing...which you don't seem to...why not just follow along and do it like I do in the video and save yourself some aggravation? Did you forget to window = Tk() at the top of your program?

    • @ame367
      @ame367 4 ปีที่แล้ว

      are you missing a mainloop for your mini instance of tkinter?

  • @ibrahimkhayat8046
    @ibrahimkhayat8046 3 ปีที่แล้ว

    How can I add this menu in a class?

    • @Codemycom
      @Codemycom  3 ปีที่แล้ว

      In the same way you add anything in a class with tkinter

  • @TunodeGaming
    @TunodeGaming 4 ปีที่แล้ว

    How to Chance cascade's font. :?

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว +1

      Not sure if you can

    • @TunodeGaming
      @TunodeGaming 4 ปีที่แล้ว

      @@Codemycom OK, thx anyway!!

  • @eduardofloresramones72
    @eduardofloresramones72 4 ปีที่แล้ว

    Very helpful :)

  • @lukemanabdelrahim3740
    @lukemanabdelrahim3740 2 ปีที่แล้ว

    Thank you so much

    • @Codemycom
      @Codemycom  2 ปีที่แล้ว

      Very Welcome!

  • @rishavmasih9450
    @rishavmasih9450 3 ปีที่แล้ว +2

    Lmao John at 0:00

    • @NEXC
      @NEXC 3 ปีที่แล้ว

      Excited for teach

  • @terfer9128
    @terfer9128 4 ปีที่แล้ว

    Which EDI you are using ?

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว

      EDI?

    • @terfer9128
      @terfer9128 4 ปีที่แล้ว

      Compeleter ?

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว

      @@terfer9128 yeah I don't know what you're talking about...I'm using sublime text

    • @terfer9128
      @terfer9128 4 ปีที่แล้ว

      Ok i have a problem . After i have done my simple calculator with ‘ thonny’ i decided to move for pycharm and i opened the simple calculator file and there is a trouble in running why ?

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว +1

      @@terfer9128 Because pycharm sucks...why not just use Sublime Text like I do in the video? It's easy. It's free.

  • @cpremix859
    @cpremix859 3 ปีที่แล้ว

    Awesome

  • @sharfer374
    @sharfer374 4 ปีที่แล้ว

    Thanks

  • @Wuottfac
    @Wuottfac 4 ปีที่แล้ว

    unknown option "-Label" why?

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว

      what did you do in your code?

    • @Wuottfac
      @Wuottfac 4 ปีที่แล้ว

      @@Codemycom i just solved my problem , thank you

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว

      @@Wuottfac awesome

    • @officialteamnight2807
      @officialteamnight2807 3 ปีที่แล้ว

      is label not Label

    • @Codemycom
      @Codemycom  ปีที่แล้ว

      @@jadenlin3724 glad to hear it!

  • @celiafernandes9084
    @celiafernandes9084 4 ปีที่แล้ว

    It is not working sir,showing error

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว

      What's the error say? They tell you what to do...

  • @ishvargh2014
    @ishvargh2014 4 ปีที่แล้ว

    I cant read that with my phone.

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว

      Everyone else can...zoom in

  • @Hh12358
    @Hh12358 4 ปีที่แล้ว

    Hi John, following is the code I tried after looking at your amazing tutorial but I don't know why it's not working.It would be amazing if you help me out.
    from tkinter import *
    root = Tk()
    root.title("HP SIMPLE FINANCE")
    w, h = root.winfo_screenwidth(), root.winfo_screenheight()
    root.geometry("%dx%d+0+0" % (w, h))
    def donothing():
    pass
    menubar = Menu(root)
    root.config(menu=menubar)
    filemenu = Menu(menubar)
    menubar.add_cascade(Label="File", Menu=filemenu)
    filemenu.add_command(Label="Open Portfolio file", command=donothing)
    filemenu.add_command(Label="Reports", command=donothing)
    filemenu.add_command(Label="New Portfolio", command=donothing)
    filemenu.add_command(Label="Restore from backup", command=donothing)
    filemenu.add_command(Label="Exit", command=root.quit)
    root.mainloop()
    The error shows as follows:
    Traceback (most recent call last):
    File "F:/Finance software/Main window.py", line 28, in
    menubar.add_cascade(Label="File", Menu=filemenu)
    File "C:\Users\harshparmar\AppData\Local\Programs\Python\Python38-32\lib\tkinter\__init__.py", line 3289, in add_cascade
    self.add('cascade', cnf or kw)
    File "C:\Users\harshparmar\AppData\Local\Programs\Python\Python38-32\lib\tkinter\__init__.py", line 3284, in add
    self.tk.call((self._w, 'add', itemType) +
    _tkinter.TclError: unknown option "-Label"
    Process finished with exit code 1

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว +2

      All those Labels need to be lowercase label

    • @Hh12358
      @Hh12358 4 ปีที่แล้ว

      @@Codemycom Hi John, I corrected it still same error, except last error changed to this:
      self.tk.call((self._w, 'add', itemType) +
      _tkinter.TclError: unknown option "-Menu"

    • @garrybeck216
      @garrybeck216 4 ปีที่แล้ว +1

      @@Hh12358 Menu (within brackets) needs to be in lower case as it is a key word and not a class.

    • @ame367
      @ame367 4 ปีที่แล้ว

      in menubar.add_cascade(Label="File", Menu=filemenu) change that "Menu" to "menu"

    • @aymaneam
      @aymaneam 2 ปีที่แล้ว

      Same problem

  • @gameknight_10
    @gameknight_10 2 ปีที่แล้ว

    Not Working

    • @Codemycom
      @Codemycom  2 ปีที่แล้ว

      Then you did it wrong. Watch the video and try again.

  • @KarimKarim-kk5mn
    @KarimKarim-kk5mn 3 ปีที่แล้ว

    Cir, please programme password

  • @atakheli3608
    @atakheli3608 4 ปีที่แล้ว +1

    If root.quit does not work, use root.destroy

  • @sarangpratham6965
    @sarangpratham6965 4 ปีที่แล้ว

    Hii

  • @Æfsænti
    @Æfsænti ปีที่แล้ว

    Many thanks to GOOGLE for automatic translation