Develop a GUI (details given below)by Using Tkinter and wxPython, compare the

code complexity of both and give your observation. (7 Marks)
Details of GUI : the GUI for Truth table should accept two bits (0 or 1) as input and produce the
Output as per the Logical operation to be chosen by pressing the button of that particular logical
operation i.e. AND, OR, NOT,NAND, NOR, XOR. You may use other suitable components like
text box, combo box, list, Radio Button, Check Box, Buttons etc. to implement the GUI.

Here is an example implementation of the GUI using Tkinter:

```python
from tkinter import *

def compute():
bit1 = int(entry1.get())
bit2 = int(entry2.get())
operation = operation_var.get()

if operation == "AND":
result = bit1 and bit2
elif operation == "OR":
result = bit1 or bit2
elif operation == "NOT":
result = not bit1
elif operation == "NAND":
result = not (bit1 and bit2)
elif operation == "NOR":
result = not (bit1 or bit2)
elif operation == "XOR":
result = bit1 ^ bit2

output_var.set(result)

root = Tk()
root.title("Truth Table")
root.geometry('300x150')

entry1 = Entry(root, width=5)
entry1.grid(row=0, column=0)

entry2 = Entry(root, width=5)
entry2.grid(row=0, column=1)

operation_var = StringVar()
operation_var.set("AND")

operation_menu = OptionMenu(root, operation_var, "AND", "OR", "NOT", "NAND", "NOR", "XOR")
operation_menu.grid(row=0, column=2)

compute_button = Button(root, text="Compute", command=compute)
compute_button.grid(row=1, column=0)

output_var = BooleanVar()
output_label = Label(root, textvariable=output_var)
output_label.grid(row=1, column=1)

root.mainloop()
```

And here is an example implementation of the GUI using wxPython:

```python
import wx

class TruthTableFrame(wx.Frame):
def __init__(self):
super().__init__(None, title="Truth Table", size=(300, 150))

self.panel = wx.Panel(self)

self.bit1_entry = wx.TextCtrl(self.panel, style=wx.TE_PROCESS_ENTER)
self.bit2_entry = wx.TextCtrl(self.panel, style=wx.TE_PROCESS_ENTER)

self.operation_choices = ["AND", "OR", "NOT", "NAND", "NOR", "XOR"]
self.operation_choice = wx.Choice(self.panel, choices=self.operation_choices)
self.operation_choice.SetSelection(0)

self.compute_button = wx.Button(self.panel, label="Compute")
self.result_label = wx.StaticText(self.panel, label="")

self.compute_button.Bind(wx.EVT_BUTTON, self.on_compute)

sizer = wx.GridSizer(rows=2, cols=2, vgap=10, hgap=10)
sizer.Add(self.bit1_entry)
sizer.Add(self.bit2_entry)
sizer.Add(self.operation_choice)
sizer.Add(self.compute_button)

main_sizer = wx.BoxSizer(wx.VERTICAL)
main_sizer.Add(sizer, flag=wx.ALL, border=10)
main_sizer.Add(self.result_label, flag=wx.ALL, border=10)

self.panel.SetSizer(main_sizer)

def on_compute(self, event):
bit1 = int(self.bit1_entry.GetValue())
bit2 = int(self.bit2_entry.GetValue())
operation = self.operation_choices[self.operation_choice.GetSelection()]

if operation == "AND":
result = bit1 and bit2
elif operation == "OR":
result = bit1 or bit2
elif operation == "NOT":
result = not bit1
elif operation == "NAND":
result = not (bit1 and bit2)
elif operation == "NOR":
result = not (bit1 or bit2)
elif operation == "XOR":
result = bit1 ^ bit2

self.result_label.SetLabelText(str(result))

app = wx.App()
frame = TruthTableFrame()
frame.Show()
app.MainLoop()
```

In terms of code complexity, both Tkinter and wxPython are relatively similar. Tkinter has a simpler and more intuitive API, which makes it easier to use for simple GUIs like this one. On the other hand, wxPython provides a more powerful and flexible framework for creating complex GUIs with advanced features.

So, if we consider the code complexity for this specific example, Tkinter has slightly lower code complexity due to its simpler API and fewer lines of code required to achieve the same functionality. However, the actual code complexity may vary depending on the specific requirements and complexity of the GUI being developed.

Overall, both Tkinter and wxPython offer a good balance between simplicity and flexibility, allowing developers to create GUIs with varying levels of complexity depending on their specific needs and preferences.