Пример #1
0
 def __init__(self, parent=None):
     super(PirateApp, self).__init__(parent)
     self.setupUi(self)
     self.pigen = pirate_generator.pirateGenerator()
     for i in range(self.tableWidget.horizontalHeader().count()):
         self.tableWidget.horizontalHeader().setSectionResizeMode(i, QtWidgets.QHeaderView.Stretch)
     for i in range(self.tableWidget.verticalHeader().count()):
         self.tableWidget.verticalHeader().setSectionResizeMode(i, QtWidgets.QHeaderView.Stretch)
     self.tableWidget.setSelectionMode(QtWidgets.QAbstractItemView.NoSelection)
     self.next_button.clicked.connect(self.next)
     self.quit_button.clicked.connect(self.close)
     self.tableWidget.setStyleSheet(tablestyle)
     self.cell_edit.returnPressed.connect(self.next)
Пример #2
0
 def __init__(self, master):
     self.pigen = pirate_generator.pirateGenerator()
     frame = tk.Frame(master)
     self.frame = frame
     frame.pack(pady=10, padx=10)
     button_frame = tk.Frame(master)
     self.button_frame = button_frame
     button_frame.pack(side=tk.RIGHT, padx=5, pady=5)
     self.ref_input = tk.Entry(frame)
     self.ref_input.grid(row=1, column=1, columnspan=2)
     self.square_label = tk.Label(frame, text="", font=("Helvetica, 34"))
     self.square_label.grid(row=0, columnspan=3)
     self.choose_label = tk.Label(frame, text="Choose next square:")
     self.choose_label.grid(row=1, column=0)
     self.quit_button = tk.Button(
                 button_frame, text="Quit", command=frame.quit)
     self.quit_button.grid(row=2, column=2)
     self.next_button = tk.Button(
                 button_frame, text="Next Square", command=self.next_square)
     self.next_button.grid(row=2, column=1)
     self.history_button = tk.Button(button_frame, text="Show history", command=self.history_window)
     self.history_button.grid(row=2, column=0)