Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def exit(self):
- print("PiCamera is closed.")
- print("GPIO pins have been released")
- self.destroy()
- class StartPage(tk.Frame):
- def __init__(self, parent, controller):
- """Initiate parent class"""
- tk.Frame.__init__(self, parent)
- self.configure(background="#0063FF")
- self.controller = controller
- """Initializing scanning pattern variables"""
- self.refresh_delay_milli = 1500
- self.n_x_steps = 9
- self.n_y_steps = 9
- self.x_step_size = 2 # in cms
- self.y_step_size = 2 # in cms
- self.grid_panel = np.zeros((self.n_x_steps+1, self.n_y_steps+1))
- self.target_list = [(i, j) for i in self.x_step_size*np.arange(self.n_x_steps+1)
- for j in self.y_step_size*np.arange(self.n_y_steps+1)]
- self.refresh_timestamp = time()
- self.grid_panel[2][7] = 1
- self.grid_panel[6][3] = 1
- self.grid_panel[5][9] = 1
- self.grid_panel[8][1] = 1
- """GPIO pins"""
- """Initialize Peripherals"""
- """Coordinate initialization"""
- self.curr_x = 0
- self.curr_y = 0
- self.curr_z = 0
- self.ysonic = '' # Either LEFT or RIGHT
- self.first_coord_fetch_flag = True # The first fetched coordinates will be used for setting Origin
- """Origin"""
- self.x_0 = 0
- self.y_0 = 0
- self.z_0 = 25
- """Target Coordinates"""
- # self.x_target = 0
- # self.y_target = 0
- # self.z_target = 0
- self.x_max = self.x_step_size * self.n_x_steps
- self.x_min = 0
- self.y_max = self.y_step_size * self.n_y_steps
- self.y_min = 0
- # self.target_update_flag_x = 0
- # self.target_update_flag_y = 0
- # self.top_to_bottom_flag = 0
- """Tolerance"""
- self.tolerance = 1.5 # in cms
- self.tolerance_z = 3 # in cms
- """Start and Stop Flags"""
- self.start_instruction_flag = 1
- self.stop_instruction_flag = 0
- # self.held_timer_start_flag = 1
- # self.held_start_time = 0
- # self.total_time_held = 0
- # self.hold_on_time_threshold = 3
- self.scan_shot_time = 1 # Assuming scanning and storing takes 1 sec
- # self.show_scanned_time_start = 0
- # self.show_scanned_time = 2
- self.calibration_flag = 1
- """Initialize Direction and Status Panel Frames"""
- self.dir_panel = DirectionPanel(self, controller)
- #self.dir_panel.grid(column=self.grid_panel.shape[0], rowspan = self.grid_panel.shape[1], padx = 50)
- self.dir_panel.grid(columnspan = 20, rowspan = 15, padx = 100, pady= 130)
- #Manual Spacers#
- tk.Label(self, text = " ", bg = "#0063FF").grid(column = 21, padx = 25)
- tk.Label(self, text = " ", bg = "#0063FF").grid(row = 0,pady = 3)
- #self.numGrid = numGrid(self, controller)
- #self.numGrid.grid()
- for r in range(self.grid_panel.shape[1]):
- for c in range(self.grid_panel.shape[0]):
- # if(int(self.grid_panel[c][r] == 0)):
- # tk.Label(self, text=int(self.grid_panel[c][r]), font = ("Helvetica", fontsize), padx = 10, bg = "#8a0404",
- # borderwidth=2 ).grid(row=r+1,column=c+22)
- # else:
- # tk.Label(self, text=int(self.grid_panel[c][r]), font = ("Helvetica", fontsize), padx = 10, bg = "yellow",
- # borderwidth=2 ).grid(row=r+1,column=c+22)
- if(int(self.grid_panel[c][r] == 0)):
- tk.Label(self, text=" ", font = ("Helvetica", fontsize), padx = 10, bg = "#8a0404",
- borderwidth=2, relief = "solid" ).grid(row=r+1,column=c+22)
- else:
- tk.Label(self, text=" ", font = ("Helvetica", fontsize), padx = 10, bg = "yellow",
- borderwidth=2, relief = "solid" ).grid(row=r+1,column=c+22)
- # self.status_panel = ScanStatusPanel(self, controller)
- # self.status_panel.pack(side="right", fill="both", expand=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement