Python Forum
[WxPython] Which def is executed?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[WxPython] Which def is executed?
#5
A Traceback? From where could I get that?
There is no error. Everything looks fine... except that in the case of the both shown defs, the one is exectued instead of the other.

I can add other menu items, they are okay. Only those both mix up.

Edit:
It'S the same without sid and rid. They were a 'remainder' of my attempts to find an access to the problem.

# -*- coding: cp1252 -*-

import wx

zd = Zeigedict = {"zeigspalten": ["A", "B"], "zeigreihen": ["a", "b"]}

class Mainframe(wx.Frame):
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title)

        self.dpbox = dpbox = wx.BoxSizer(wx.HORIZONTAL) 
        self.SetSizer(dpbox)

        # # # Teil 2: Menubalken        
        menuBar = wx.MenuBar()

        setzenMenu = wx.Menu()
        setzenMenu.Append(wx.ID_ANY, "Spalten", "Spaltengruppen setzen")
        wx.EVT_MENU(self, wx.ID_ANY, self.OnZeigspalten)
        setzenMenu.Append(wx.ID_ANY, "Reihen", "Reihengruppen setzen")
        wx.EVT_MENU(self, wx.ID_ANY, self.OnZeigreihen)

        menuBar.Append(setzenMenu, "Setzen")
        self.SetMenuBar(menuBar)

        self.Show()
        

    def OnZeigspalten(self, event):
        self.spalcmbb = spalcmbb = wx.MultiChoiceDialog(self, 
                                   "Spaltenauswahl nach Gruppen",
                                   "Spaltenauswahl nach Gruppen",
                                    zd["zeigspalten"])

        if (spalcmbb.ShowModal() == wx.ID_OK):
            spaltenwahl = spalcmbb.GetSelections()
            print "gewählt sind Spalten: ", spaltenwahl
            print "-> ",
            for sw in spaltenwahl:
                print zd["zeigspalten"][sw], ", ",
            print  


        spalcmbb.Destroy()
        return
        
    def OnZeigreihen(self, event):
        self.reihcmbb = reihcmbb = wx.MultiChoiceDialog(self, 
                                   "Reihenauswahl nach Gruppen",
                                   "Reihenauswahl nach Gruppen",
                                    zd["zeigreihen"])

        if (reihcmbb.ShowModal() == wx.ID_OK):
            reihenwahl = reihcmbb.GetSelections()
            print "gewählt sind Reihen: ", reihenwahl


        reihcmbb.Destroy()
        return

if __name__ == "__main__": 

    app = wx.App(0)
    preframe = Mainframe(None, -1, "Anfangsauswahl")   
    app.MainLoop() 
Reply


Messages In This Thread
Which def is executed? - by merlem - Feb-09-2017, 01:57 PM
RE: Which def is executed? - by Larz60+ - Feb-09-2017, 02:25 PM
RE: Which def is executed? - by merlem - Feb-09-2017, 03:14 PM
RE: Which def is executed? - by Larz60+ - Feb-09-2017, 06:44 PM
RE: Which def is executed? - by merlem - Feb-09-2017, 07:00 PM
RE: Which def is executed? - by Larz60+ - Feb-09-2017, 07:51 PM
RE: Which def is executed? - by merlem - Feb-09-2017, 08:13 PM
RE: Which def is executed? - by Larz60+ - Feb-09-2017, 09:22 PM
RE: Which def is executed? - by Yoriz - Feb-09-2017, 09:59 PM
RE: Which def is executed? - by merlem - Feb-10-2017, 10:26 AM
RE: Which def is executed? - by Yoriz - Feb-10-2017, 11:28 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] messagebox is not being executed please help erwinsiuda 2 2,319 Apr-02-2020, 01:56 AM
Last Post: Larz60+
  [Tkinter] Window unresponsive when executed. fawazcode 2 3,819 Sep-11-2017, 12:29 AM
Last Post: Larz60+
  [xbmc] How to block the code from executed twice under the loop chris0147 29 23,282 Oct-26-2016, 05:34 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020