Hi i have a question about the python.

You are required to write a Python program which will solve system of linear equations with 3 unknowns
(to be entered by the user).
Your program should display a menu which will allow the user to choose whether he wants to (1)
coefficients (2) check whether the linear system can be solved using iteration (3) calculate and display the
required results using Gauss-Seidel (4) calculate and display the required results using Gauss-Jacobi
Note that in all cases, the outcomes of the iterations should be displayed. Also if the values of the
unknowns are not converging, your program should stop at the 15th iteration.

Comments

  • import wx
    class TextEditor(wx.Frame):
    def __init__(self, parent, id, title):
    wx.Frame.__init__(self, parent, id, title, size=(350, 600))
    # self/Text editor is now a Window with all attribute of a frame
    # create status bar
    self.CreateStatusBar()
    # set default status bar string
    self.SetStatusText("For help press F1")
    # define sizers
    vbox = wx.BoxSizer(wx.VERTICAL)
    hbox = wx.BoxSizer(wx.HORIZONTAL)

    #Add menu
    #define menubar and menu
    menubar = wx.MenuBar()
    # attach menubar to the frame
    self.SetMenuBar(menubar)
    #define menus
    filemenu = wx.Menu()
    #Add any other menu using same trick eg. help = wx.Menu() or print = wx.Menu()
    # Append items to menu predefined (For now file menu)
    filemenu.Append(-1, "&New", "New Blank file")
    # same for help menu i.e help.Append(menu id, menu caption, status bar text )
    #-----------------------------------------------
    # Append a separator -- line to separate menus
    filemenu.AppendSeparator()
    #Print menu
    filemenu.Append(-1, "&Print", "Print file")
    #-------------------------------------------------------
    #Append print menu to menubar
    menubar.Append(filemenu, "&File")
    # also menubar.Append(menu name, caption)
    # Note: as in VB, & is for ALT+F


    #------------------------------------

    #center the window
    self.Center()
    #show the window(without this the windows will not show up)
    self.Show(True)


    #our main application
    app = wx.App(False)
    TextEditor(None, -1, "Text Editor")
    app.MainLoop()
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion