Re: a question for the wx python users here

2019-08-18 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: a question for the wx python users here

Use the "&" symbol in the name description, or alternatively you can use "\t" for a different kind of keyboard shortcut, like so:#create menu bar
menuBar = wx.MenuBar()
#file Menu tab
menu = wx.Menu()
#open file
m_load = menu.Append(wx.ID_OPEN,"", "Load an image")
self.Bind(wx.EVT_MENU, self.Open, m_load)
#exit program
m_exit = menu.Append(wx.ID_EXIT, "E\tAlt-X", "Close window and exit program.")
self.Bind(wx.EVT_MENU, self.OnClose, m_exit)
#append this menubar tab
menuBar.Append(menu, "")In this example, "O" in Open is setup as the shortcut, "X" is setup for the shortcut to exit, and "F" is the shortcut for File, its whichever the character is after the "&" symbol. But Alt+X is also setup as a global keyboard shortcut you can use without opening the file menu first, by using "\t" followed by the key shortcut in the name string, in this case "\tAlt-X".

URL: https://forum.audiogames.net/post/456446/#p456446




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: a question for the wx python users here

2019-08-18 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: a question for the wx python users here

Use the "&" symbol in the name description, or alternatively you can use "\t" for a different kind of keyboard shortcut, like so:#create menu bar
menuBar = wx.MenuBar()
#file Menu tab
menu = wx.Menu()
#open file
m_load = menu.Append(wx.ID_OPEN,"", "Load an image")
self.Bind(wx.EVT_MENU, self.Open, m_load)
#exit program
m_exit = menu.Append(wx.ID_EXIT, "E\tAlt-X", "Close window and exit program.")
self.Bind(wx.EVT_MENU, self.OnClose, m_exit)
#append this menubar tab
menuBar.Append(menu, "")In this example, "O" in Open is setup as the shortcut, "X" is setup for the shortcut to exit, and F is the shortcut for File, its whichever the character is after the "&" symbol. But Alt+X is also setup as a global keyboard shortcut you can use without opening the file menu first, by using "\t" followed by the key shortcut in the name string, in this case "\tAlt-X".

URL: https://forum.audiogames.net/post/456446/#p456446




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: a question for the wx python users here

2019-08-18 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: a question for the wx python users here

Use the "&" symbol in the name description, or alternatively you can use "\t" for a different kind ofkeyboard shortcut, like so:#create menu bar
menuBar = wx.MenuBar()
#file Menu tab
menu = wx.Menu()
#open file
m_load = menu.Append(wx.ID_OPEN,"", "Load an image")
self.Bind(wx.EVT_MENU, self.Open, m_load)
#exit program
m_exit = menu.Append(wx.ID_EXIT, "E\tAlt-X", "Close window and exit program.")
self.Bind(wx.EVT_MENU, self.OnClose, m_exit)
#append this menubar tab
menuBar.Append(menu, "")In this example, "O" in Open is setup as the shortcut, "X" is setup for the shortcut to exit, and F is the shortcut for File, its whichever the character is after the "&" symbol. But Alt+X is also setup as a global keyboard shortcut you can use without opening the file menu first, by using "/t" followed by the key shortcut in the name string.

URL: https://forum.audiogames.net/post/456446/#p456446




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: a question for the wx python users here

2019-08-18 Thread AudioGames . net Forum — Developers room : SkyGuardian via Audiogames-reflector


  


Re: a question for the wx python users here

sorry for the double post, but how do i set a menu short cut so instead of it saying save as s it could say something like save as A, and when you press the A key in the file menu, it will activate the shortcut that i have created

URL: https://forum.audiogames.net/post/456441/#p456441




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: a question for the wx python users here

2019-08-18 Thread AudioGames . net Forum — Developers room : SkyGuardian via Audiogames-reflector


  


Re: a question for the wx python users here

thank you so much, it works now, hopefully this is the last bug with this thingy, lol

URL: https://forum.audiogames.net/post/456440/#p456440




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: a question for the wx python users here

2019-08-18 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: a question for the wx python users here

Its no problem, heh. It looks like this is a simple capitalization mistake as indicated in the NameError traceback, "saveas" is all lower case, but in GUI.__init__() its defined as "saveAs" with a capitol A for as:class GUI(wx.Frame):   
def __init__(self):
saveAs = firstMenu.Append(wx.ID_SAVEAS, "Save As")
self.Bind(wx.EVT_MENU, self.SaveAs, saveas)It seems to work fine otherwise, though I also noticed a minor spelling issue in the text of the copy menu option:copy = secondMenu.Append(wx.ID_COPY, "Coppy")

URL: https://forum.audiogames.net/post/456431/#p456431




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: a question for the wx python users here

2019-08-18 Thread AudioGames . net Forum — Developers room : SkyGuardian via Audiogames-reflector


  


Re: a question for the wx python users here

i am sorry to bother you once again, but another problem has occurred, now, the save as dialog is acting up as well with a different error, first i shall post the traceback and after that will be the code, and please note, i tried my best to solve this problem before posting up her againTraceback (most recent call last):  File "window.py", line 46, in     frame = GUI()  File "window.py", line 15, in __init__    self.Bind(wx.EVT_MENU, self.SaveAs, saveas)NameError: name 'saveas' is not definedand here is the codeimport osimport wxclass GUI(wx.Frame):        def __init__(self):        super().__init__(parent=None, title='Spirit')        controls = wx.Panel(self)        text_field = wx.TextCtrl(controls,style = wx.TE_MULTILINE|wx.TE_PROCESS_TAB|wx.TE_NOHIDESEL)        menuBar = wx.MenuBar()        firstMenu = wx.Menu()        new = firstMenu.Append(wx.ID_NEW, "New")        open = firstMenu.Append(wx.ID_OPEN, "Open")        self.Bind(wx.EVT_MENU, self.Open, open)        save = firstMenu.Append(wx.ID_SAVE, "Save")        saveAs = firstMenu.Append(wx.ID_SAVEAS, "Save As")        self.Bind(wx.EVT_MENU, self.SaveAs, saveas)        print = firstMenu.Append(wx.ID_PRINT, "Print")        ExitApp = firstMenu.Append(wx.ID_EXIT, 'Quit')        menuBar.Append(firstMenu, "")        secondMenu = wx.Menu()        undo = secondMenu.Append(wx.ID_UNDO,"Undo")        cut = secondMenu.Append(wx.ID_CUT, "Cut")        copy = secondMenu.Append(wx.ID_COPY, "Coppy")        paste = secondMenu.Append(wx.ID_PASTE, "Paste")        delete = secondMenu.Append(wx.ID_DELETE, "Delete")        find = secondMenu.Append(wx.ID_FIND, "Find")        selectAll = secondMenu.Append(wx.ID_SELECTALL, "Select All")        menuBar.Append(secondMenu, "edit")        self.SetMenuBar(menuBar)    def Open(self, event):        openFileDialog = wx.FileDialog(frame, "Open", "", "",       "text files (*.txt)|*.txt",        wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)        openFileDialog.ShowModal()        print(openFileDialog.GetPath())        openFileDialog.Destroy()    def SaveAs(self, event):        saveFileDialog = wx.FileDialog(frame, "saveas", "", "",        "text files (*.txt)|*.txt",         wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT)        saveFileDialog.ShowModal()        print(saveFileDialog.GetPath())        saveFileDialog.Destroy()        self.Show()if __name__ == '__main__':    app = wx.App()    frame = GUI()    frame.Show()    app.MainLoop()hopefully, this is the last error i will have to bother people with

URL: https://forum.audiogames.net/post/456426/#p456426




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: a question for the wx python users here

2019-08-15 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: a question for the wx python users here

When you create a widget, you have to enable its "show" function for it to display the window. So at the bottom of the code add in frame.Show() like so:if __name__ == '__main__':
app = wx.App()
frame = GUI()
frame.Show()
app.MainLoop()

URL: https://forum.audiogames.net/post/455753/#p455753




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: a question for the wx python users here

2019-08-15 Thread AudioGames . net Forum — Developers room : SkyGuardian via Audiogames-reflector


  


Re: a question for the wx python users here

that previous problem seems to be resolved, but another problem has taken its placei ran the project, but now, it doesn't do anything, it just shows a blank command prompt window, no text, no trace backs, nothing shows uphere is the code for the window, i don't know if this will send properly, please keep in mind that this is incomplete, some of the menus have not been addedimport osimport wxclass GUI(wx.Frame):        def __init__(self):        super().__init__(parent=None, title='Spirit')        controls = wx.Panel(self)        text_field = wx.TextCtrl(controls,style = wx.TE_MULTILINE|wx.TE_PROCESS_TAB|wx.TE_NOHIDESEL)        menuBar = wx.MenuBar()        firstMenu = wx.Menu()        new = firstMenu.Append(wx.ID_NEW, "New")        open = firstMenu.Append(wx.ID_OPEN, "Open")        self.Bind(wx.EVT_MENU, self.Open, open)        save = firstMenu.Append(wx.ID_SAVE, "Save")        saveAs = firstMenu.Append(wx.ID_SAVEAS, "Save As")        print = firstMenu.Append(wx.ID_PRINT, "Print")        ExitApp = firstMenu.Append(wx.ID_EXIT, 'Quit')        menuBar.Append(firstMenu, "")        secondMenu = wx.Menu()        undo = secondMenu.Append(wx.ID_UNDO,"Undo")        cut = secondMenu.Append(wx.ID_CUT, "Cut")        copy = secondMenu.Append(wx.ID_COPY, "Coppy")        paste = secondMenu.Append(wx.ID_PASTE, "Paste")        delete = secondMenu.Append(wx.ID_DELETE, "Delete")        find = secondMenu.Append(wx.ID_FIND, "Find")        selectAll = secondMenu.Append(wx.ID_SELECTALL, "Select All")        menuBar.Append(secondMenu, "edit")        self.SetMenuBar(menuBar)    def Open(self, event):        openFileDialog = wx.FileDialog(GUI, "Open", "", "",       "Plain text files (*.txt)|*.txt",        wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)        openFileDialog.ShowModal()        openFileDialog.Destroy()        self.Show()if __name__ == '__main__':    app = wx.App()    frame = GUI()    app.MainLoop()

URL: https://forum.audiogames.net/post/455622/#p455622




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: a question for the wx python users here

2019-08-14 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: a question for the wx python users here

Its effectively saying that your GUI() class has no function called self.Open, without seeing the class itself its difficult to say whether its a simple misspelling or something else. Something like this should work as expected:import wx

class Frame(wx.Frame):
def __init__(self, title):
wx.Frame.__init__(self, None, title=title, pos=(150,150), size=(350,200))

#create menu bar
menuBar = wx.MenuBar()
#file Menu tab
menu = wx.Menu()
#open file
m_load = menu.Append(wx.ID_OPEN,"", "Load an image")
#bind open function
self.Bind(wx.EVT_MENU, self.Open, m_load)
#append this menubar tab
menuBar.Append(menu, "")

 #set the menu bar
self.SetMenuBar(menuBar)

def Open(self, event):
self.SetTitle('success')


app = wx.App()
top = Frame("<>")
top.Show()
app.MainLoop()

URL: https://forum.audiogames.net/post/455524/#p455524




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


a question for the wx python users here

2019-08-14 Thread AudioGames . net Forum — Developers room : SkyGuardian via Audiogames-reflector


  


a question for the wx python users here

i have managed to create an application skeleton of a text editor that i am working on, i have created the main edit box and the menus, and now i am trying to bind events to the menu items, my first attempt was the open file dialog, and i ran it after implementing the code for the open dialog and i got this, note, if you need the code that i used, i can post it, but here is what i got after running this fileTraceback (most recent call last):  File "window.py", line 53, in     frame = GUI()  File "window.py", line 13, in __init__    self.Bind(wx.EVT_MENU, self.Open, menu_open)AttributeError: 'GUI' object has no attribute 'Open'if anyone knows how i can fix this, please tell me, thanks for the help

URL: https://forum.audiogames.net/post/455520/#p455520




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector