Output-ing functions into a text box, tkinter












-4















Please can you help me out? I am trying to create buttons that follow a function then output in a text box, this is my code so far:



root = Tk()
menu = Menu(root)
root.config(menu=menu)
filemenu = Menu(menu)
root.filemenu = filedialog.askopenfilename()
menu.add_cascade(label="New Measures", menu=newMeasures)
filemenu.add_command(label="See all measures", command=getMeasures)
filemenu.add_command(label="See the total rain", command=totalRain)
filemenu.add_command(label="See the total electricity", command=totalElectricity)
filemenu.add_command(label="See the measures for a date", command=find_date)
#filemenu.add_command(label="Change the data for a date", command=edit_date)
filemenu.add_separator()
filemenu.add_command(label="Exit", command=root.destroy)


But it is not doing anything - it just shows an empty tk() box










share|improve this question























  • Your code does not create any text boxes and raises NameError.

    – Goyo
    Nov 20 '18 at 12:08











  • 1. You are not using a text-box in this code. 2. root.filemenu is a terrible name for a variable and honestly I didn't even think root.filemenu would work. 3. you have all these labels and each one has different commands but you do not show what these functions are doing so there is no way to know what is wrong with your code. 4. You need to also include the imports you are using.

    – Mike - SMT
    Nov 20 '18 at 13:01


















-4















Please can you help me out? I am trying to create buttons that follow a function then output in a text box, this is my code so far:



root = Tk()
menu = Menu(root)
root.config(menu=menu)
filemenu = Menu(menu)
root.filemenu = filedialog.askopenfilename()
menu.add_cascade(label="New Measures", menu=newMeasures)
filemenu.add_command(label="See all measures", command=getMeasures)
filemenu.add_command(label="See the total rain", command=totalRain)
filemenu.add_command(label="See the total electricity", command=totalElectricity)
filemenu.add_command(label="See the measures for a date", command=find_date)
#filemenu.add_command(label="Change the data for a date", command=edit_date)
filemenu.add_separator()
filemenu.add_command(label="Exit", command=root.destroy)


But it is not doing anything - it just shows an empty tk() box










share|improve this question























  • Your code does not create any text boxes and raises NameError.

    – Goyo
    Nov 20 '18 at 12:08











  • 1. You are not using a text-box in this code. 2. root.filemenu is a terrible name for a variable and honestly I didn't even think root.filemenu would work. 3. you have all these labels and each one has different commands but you do not show what these functions are doing so there is no way to know what is wrong with your code. 4. You need to also include the imports you are using.

    – Mike - SMT
    Nov 20 '18 at 13:01
















-4












-4








-4








Please can you help me out? I am trying to create buttons that follow a function then output in a text box, this is my code so far:



root = Tk()
menu = Menu(root)
root.config(menu=menu)
filemenu = Menu(menu)
root.filemenu = filedialog.askopenfilename()
menu.add_cascade(label="New Measures", menu=newMeasures)
filemenu.add_command(label="See all measures", command=getMeasures)
filemenu.add_command(label="See the total rain", command=totalRain)
filemenu.add_command(label="See the total electricity", command=totalElectricity)
filemenu.add_command(label="See the measures for a date", command=find_date)
#filemenu.add_command(label="Change the data for a date", command=edit_date)
filemenu.add_separator()
filemenu.add_command(label="Exit", command=root.destroy)


But it is not doing anything - it just shows an empty tk() box










share|improve this question














Please can you help me out? I am trying to create buttons that follow a function then output in a text box, this is my code so far:



root = Tk()
menu = Menu(root)
root.config(menu=menu)
filemenu = Menu(menu)
root.filemenu = filedialog.askopenfilename()
menu.add_cascade(label="New Measures", menu=newMeasures)
filemenu.add_command(label="See all measures", command=getMeasures)
filemenu.add_command(label="See the total rain", command=totalRain)
filemenu.add_command(label="See the total electricity", command=totalElectricity)
filemenu.add_command(label="See the measures for a date", command=find_date)
#filemenu.add_command(label="Change the data for a date", command=edit_date)
filemenu.add_separator()
filemenu.add_command(label="Exit", command=root.destroy)


But it is not doing anything - it just shows an empty tk() box







python tkinter sqlite3






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 20 '18 at 12:00









MrTForresterMrTForrester

32




32













  • Your code does not create any text boxes and raises NameError.

    – Goyo
    Nov 20 '18 at 12:08











  • 1. You are not using a text-box in this code. 2. root.filemenu is a terrible name for a variable and honestly I didn't even think root.filemenu would work. 3. you have all these labels and each one has different commands but you do not show what these functions are doing so there is no way to know what is wrong with your code. 4. You need to also include the imports you are using.

    – Mike - SMT
    Nov 20 '18 at 13:01





















  • Your code does not create any text boxes and raises NameError.

    – Goyo
    Nov 20 '18 at 12:08











  • 1. You are not using a text-box in this code. 2. root.filemenu is a terrible name for a variable and honestly I didn't even think root.filemenu would work. 3. you have all these labels and each one has different commands but you do not show what these functions are doing so there is no way to know what is wrong with your code. 4. You need to also include the imports you are using.

    – Mike - SMT
    Nov 20 '18 at 13:01



















Your code does not create any text boxes and raises NameError.

– Goyo
Nov 20 '18 at 12:08





Your code does not create any text boxes and raises NameError.

– Goyo
Nov 20 '18 at 12:08













1. You are not using a text-box in this code. 2. root.filemenu is a terrible name for a variable and honestly I didn't even think root.filemenu would work. 3. you have all these labels and each one has different commands but you do not show what these functions are doing so there is no way to know what is wrong with your code. 4. You need to also include the imports you are using.

– Mike - SMT
Nov 20 '18 at 13:01







1. You are not using a text-box in this code. 2. root.filemenu is a terrible name for a variable and honestly I didn't even think root.filemenu would work. 3. you have all these labels and each one has different commands but you do not show what these functions are doing so there is no way to know what is wrong with your code. 4. You need to also include the imports you are using.

– Mike - SMT
Nov 20 '18 at 13:01














1 Answer
1






active

oldest

votes


















0














When you add the first dropdown button to the menu you are trying to put it in the menu "newMeasures", which does not exist.



menu.add_cascade(label="New Measures", menu=newMeasures)


The menu you created is called "filemenu".



menu.add_cascade(label="New Measures", menu=filemenu)





share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53392561%2foutput-ing-functions-into-a-text-box-tkinter%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    When you add the first dropdown button to the menu you are trying to put it in the menu "newMeasures", which does not exist.



    menu.add_cascade(label="New Measures", menu=newMeasures)


    The menu you created is called "filemenu".



    menu.add_cascade(label="New Measures", menu=filemenu)





    share|improve this answer




























      0














      When you add the first dropdown button to the menu you are trying to put it in the menu "newMeasures", which does not exist.



      menu.add_cascade(label="New Measures", menu=newMeasures)


      The menu you created is called "filemenu".



      menu.add_cascade(label="New Measures", menu=filemenu)





      share|improve this answer


























        0












        0








        0







        When you add the first dropdown button to the menu you are trying to put it in the menu "newMeasures", which does not exist.



        menu.add_cascade(label="New Measures", menu=newMeasures)


        The menu you created is called "filemenu".



        menu.add_cascade(label="New Measures", menu=filemenu)





        share|improve this answer













        When you add the first dropdown button to the menu you are trying to put it in the menu "newMeasures", which does not exist.



        menu.add_cascade(label="New Measures", menu=newMeasures)


        The menu you created is called "filemenu".



        menu.add_cascade(label="New Measures", menu=filemenu)






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 20 '18 at 12:54









        figbeamfigbeam

        3,0251310




        3,0251310
































            draft saved

            draft discarded




















































            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.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53392561%2foutput-ing-functions-into-a-text-box-tkinter%23new-answer', 'question_page');
            }
            );

            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







            Popular posts from this blog

            How to change which sound is reproduced for terminal bell?

            Can I use Tabulator js library in my java Spring + Thymeleaf project?

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents