(Python) Line Break for PyQt5 Menu Bar -


help needed pyqt5 menu bar:

i started getting pyqt5, , i'm making menu bar gui application. below code made menu far:

import sys pyqt5.qtwidgets import qapplication, qmainwindow, qaction, qapp   class menudemo(qmainwindow):     def __init__(self):         super().__init__()  ####################################################          # creates initial menu bar         bar = self.menubar()          # creates menu bar tabs & names them         file = bar.addmenu('file')         edit = bar.addmenu('edit')         helpme = bar.addmenu('help')          # creates actions 'file' section         new_action = qaction('new file', self)         new_action.setshortcut('ctrl+n')          open_action = qaction('open file', self)         open_action.setshortcut('ctrl+o')          save_action = qaction('save', self)         save_action.setshortcut('ctrl+s')          save_as_action = qaction('save as...', self)         save_as_action.setshortcut('ctrl+shift+s')          quit_action = qaction('quit', self)         quit_action.setshortcut('ctrl+q')          # creates actions 'edit' section         undo_action = qaction('undo', self)         undo_action.setshortcut('ctrl+z')          redo_action = qaction('redo', self)         redo_action.setshortcut('ctrl+y')          # creates actions "help" section         doc_action = qaction('documentation', self)         # no shortcut needed          about_action = qaction('about', self)         # no shortcut needed  ####################################################          # adds actions menu bar under 'file'  tab         file.addaction(new_action)         file.addaction(open_action)         file.addaction(save_action)         file.addaction(save_as_action)         file.addaction(quit_action)          # adds actions menu bar under 'edit'  tab         edit.addaction(undo_action)         edit.addaction(redo_action)          # adds actions menu bar under 'help' tab         helpme.addaction(doc_action)         helpme.addaction(about_action)          # events          # sets initial window size , title         self.setwindowtitle('my menu')         self.resize(750, 500)          self.show()  ####################################################  def quit_trigger(self):     pass   def selected(self, q):     pass   app = qapplication(sys.argv) menus = menudemo() sys.exit(app.exec_()) 

problem:

i have menu bar displayed, , seems run fine, there 1 thing bugging me. under 'file' tab of menu, there option called 'quit'. above 'quit' option, need have sort of line break seperate option rest of other options. in tkinter simple task do, can't seem find how pyqt5. appreciated!

p.s: menu items buttons, dont yet.

addseparator method of qmenu occasion:

# ... file.addaction(save_as_action) file.addseparator() file.addaction(quit_action) # ... 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -