Button generating (wx.Python, Python)












-1















I am developing a wxpython, i am looking for button generating, for example.




  1. In text box enter the value how many button have to generate.


  2. While submitting that, i have to show in panel as many as button



def __init__(self):
wx.Frame.__init__(self, None, wx.ID_ANY, "Background Reset Tutorial",size=wx.Size(500,500))

# Add a panel so it looks the correct on all platforms
self.panel = wx.Panel(self, wx.ID_ANY)
self.txt = wx.TextCtrl(self.panel,id=wx.ID_ANY,pos=(185,40))
txtSizer = wx.BoxSizer(wx.HORIZONTAL)


self.btn = wx.Button(self.panel,id=wx.ID_ANY,label="Submit",pos=
(190,70),size=(100,30))
self.btn.Bind(wx.EVT_BUTTON,self.onSubmit)
def onSubmit(self,event):
gettxt = self.txt.GetValue()









share|improve this question





























    -1















    I am developing a wxpython, i am looking for button generating, for example.




    1. In text box enter the value how many button have to generate.


    2. While submitting that, i have to show in panel as many as button



    def __init__(self):
    wx.Frame.__init__(self, None, wx.ID_ANY, "Background Reset Tutorial",size=wx.Size(500,500))

    # Add a panel so it looks the correct on all platforms
    self.panel = wx.Panel(self, wx.ID_ANY)
    self.txt = wx.TextCtrl(self.panel,id=wx.ID_ANY,pos=(185,40))
    txtSizer = wx.BoxSizer(wx.HORIZONTAL)


    self.btn = wx.Button(self.panel,id=wx.ID_ANY,label="Submit",pos=
    (190,70),size=(100,30))
    self.btn.Bind(wx.EVT_BUTTON,self.onSubmit)
    def onSubmit(self,event):
    gettxt = self.txt.GetValue()









    share|improve this question



























      -1












      -1








      -1








      I am developing a wxpython, i am looking for button generating, for example.




      1. In text box enter the value how many button have to generate.


      2. While submitting that, i have to show in panel as many as button



      def __init__(self):
      wx.Frame.__init__(self, None, wx.ID_ANY, "Background Reset Tutorial",size=wx.Size(500,500))

      # Add a panel so it looks the correct on all platforms
      self.panel = wx.Panel(self, wx.ID_ANY)
      self.txt = wx.TextCtrl(self.panel,id=wx.ID_ANY,pos=(185,40))
      txtSizer = wx.BoxSizer(wx.HORIZONTAL)


      self.btn = wx.Button(self.panel,id=wx.ID_ANY,label="Submit",pos=
      (190,70),size=(100,30))
      self.btn.Bind(wx.EVT_BUTTON,self.onSubmit)
      def onSubmit(self,event):
      gettxt = self.txt.GetValue()









      share|improve this question
















      I am developing a wxpython, i am looking for button generating, for example.




      1. In text box enter the value how many button have to generate.


      2. While submitting that, i have to show in panel as many as button



      def __init__(self):
      wx.Frame.__init__(self, None, wx.ID_ANY, "Background Reset Tutorial",size=wx.Size(500,500))

      # Add a panel so it looks the correct on all platforms
      self.panel = wx.Panel(self, wx.ID_ANY)
      self.txt = wx.TextCtrl(self.panel,id=wx.ID_ANY,pos=(185,40))
      txtSizer = wx.BoxSizer(wx.HORIZONTAL)


      self.btn = wx.Button(self.panel,id=wx.ID_ANY,label="Submit",pos=
      (190,70),size=(100,30))
      self.btn.Bind(wx.EVT_BUTTON,self.onSubmit)
      def onSubmit(self,event):
      gettxt = self.txt.GetValue()






      python wxpython wxpython-phoenix






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 12 '18 at 13:48









      Mohammad

      15.7k123562




      15.7k123562










      asked Nov 12 '18 at 13:03









      vinay doddapanenivinay doddapaneni

      54




      54
























          1 Answer
          1






          active

          oldest

          votes


















          0














          I got the solution



          def onBtn(self,event):



              self.val = self.txtstring1.GetValue()
          Blue = wx.Button(self,label="Blue",pos=(30,50))
          Blue.Bind(wx.EVT_BUTTON,self.onBlue)

          Green = wx.Button(self,label="Green",pos=(300,50))
          Green.Bind(wx.EVT_BUTTON,self.onGreen)
          for self.button_name in range(self.val):
          self.btn = wx.Button(self, label=str(self.button_name),pos=(50,50))
          self.btn.Bind(wx.EVT_BUTTON, lambda evt, temp=self.button_name:
          self.OnButton(evt, temp))
          self.widgetSizer.Add(self.btn, 0, wx.ALL|wx.CENTER, 5)





          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%2f53262792%2fbutton-generating-wx-python-python%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














            I got the solution



            def onBtn(self,event):



                self.val = self.txtstring1.GetValue()
            Blue = wx.Button(self,label="Blue",pos=(30,50))
            Blue.Bind(wx.EVT_BUTTON,self.onBlue)

            Green = wx.Button(self,label="Green",pos=(300,50))
            Green.Bind(wx.EVT_BUTTON,self.onGreen)
            for self.button_name in range(self.val):
            self.btn = wx.Button(self, label=str(self.button_name),pos=(50,50))
            self.btn.Bind(wx.EVT_BUTTON, lambda evt, temp=self.button_name:
            self.OnButton(evt, temp))
            self.widgetSizer.Add(self.btn, 0, wx.ALL|wx.CENTER, 5)





            share|improve this answer






























              0














              I got the solution



              def onBtn(self,event):



                  self.val = self.txtstring1.GetValue()
              Blue = wx.Button(self,label="Blue",pos=(30,50))
              Blue.Bind(wx.EVT_BUTTON,self.onBlue)

              Green = wx.Button(self,label="Green",pos=(300,50))
              Green.Bind(wx.EVT_BUTTON,self.onGreen)
              for self.button_name in range(self.val):
              self.btn = wx.Button(self, label=str(self.button_name),pos=(50,50))
              self.btn.Bind(wx.EVT_BUTTON, lambda evt, temp=self.button_name:
              self.OnButton(evt, temp))
              self.widgetSizer.Add(self.btn, 0, wx.ALL|wx.CENTER, 5)





              share|improve this answer




























                0












                0








                0







                I got the solution



                def onBtn(self,event):



                    self.val = self.txtstring1.GetValue()
                Blue = wx.Button(self,label="Blue",pos=(30,50))
                Blue.Bind(wx.EVT_BUTTON,self.onBlue)

                Green = wx.Button(self,label="Green",pos=(300,50))
                Green.Bind(wx.EVT_BUTTON,self.onGreen)
                for self.button_name in range(self.val):
                self.btn = wx.Button(self, label=str(self.button_name),pos=(50,50))
                self.btn.Bind(wx.EVT_BUTTON, lambda evt, temp=self.button_name:
                self.OnButton(evt, temp))
                self.widgetSizer.Add(self.btn, 0, wx.ALL|wx.CENTER, 5)





                share|improve this answer















                I got the solution



                def onBtn(self,event):



                    self.val = self.txtstring1.GetValue()
                Blue = wx.Button(self,label="Blue",pos=(30,50))
                Blue.Bind(wx.EVT_BUTTON,self.onBlue)

                Green = wx.Button(self,label="Green",pos=(300,50))
                Green.Bind(wx.EVT_BUTTON,self.onGreen)
                for self.button_name in range(self.val):
                self.btn = wx.Button(self, label=str(self.button_name),pos=(50,50))
                self.btn.Bind(wx.EVT_BUTTON, lambda evt, temp=self.button_name:
                self.OnButton(evt, temp))
                self.widgetSizer.Add(self.btn, 0, wx.ALL|wx.CENTER, 5)






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 19 '18 at 4:59

























                answered Nov 15 '18 at 5:24









                vinay doddapanenivinay doddapaneni

                54




                54
































                    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%2f53262792%2fbutton-generating-wx-python-python%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

                    Xamarin.iOS Cant Deploy on Iphone

                    Glorious Revolution

                    Dulmage-Mendelsohn matrix decomposition in Python