Ejemplo n.º 1
0
 def __init__(self, m_root, m_timeKeeper, m_hoopSignal, m_freq):
     self.score = 0
     self.timeKeeper = m_timeKeeper
     self.ssWidget = tk_tools.SevenSegmentDigits(m_root, digits=2, background='black', digit_color='red', height=300)
     self.ssWidget.set_value(str(0))
     self.hoopSensor = hs.HoopSensor(m_hoopSignal, self.__handleScore)
     self.buzzer = bc.BuzzerChime(0.25, 'sine', 0.125, m_freq)
Ejemplo n.º 2
0
 def __init__(self, m_root, m_freq):
     self.ssWidget = tk_tools.SevenSegmentDigits(m_root, digits=2, background='black', digit_color='yellow', height=175)
     self.defaultTime = 30
     self.gameTime = 0
     self.root = m_root
     self.buzzer = bc.BuzzerChime(0.75, 'sawtooth', 1.5, m_freq)
     self.hurryBuzzer = bc.BuzzerChime(0.5, 'square', 0.25, m_freq)
     self.runIt = True
     #m_root.after(1000, self.__update_time)
     self.reset()
Ejemplo n.º 3
0
 def __init__(self, m_root, m_timeKeeper, m_hoopSignal):
     self.timeKeeper = m_timeKeeper
     self.ssWidget = tk_tools.SevenSegmentDigits(m_root,
                                                 digits=2,
                                                 background='black',
                                                 digit_color='red',
                                                 height=300)
     self.ssWidget.set_value('0')
     self.hoopSensor = hs.HoopSensor(m_hoopSignal, self.__handleScore)
     self.rightbuzzer = bc.BuzzerChime(0.25, 'sine', 0.125, 720)
     self.wrongbuzzer = bc.BuzzerChime(0.25, 'sawtooth', 0.125, 110)
     self.acceptingInput = False
     self.isCorrect = False
Ejemplo n.º 4
0
    def create_widgets(self):
        global stop

        # Pack Voltage Gauge
        self.pvgauge = tk_tools.Gauge(self,
                                      height=200,
                                      width=400,
                                      min_value=10,
                                      max_value=20,
                                      label='Pack Voltage',
                                      unit=' V',
                                      divisions=30,
                                      yellow=66,
                                      red=70,
                                      yellow_low=43,
                                      red_low=40)
        #bg='grey')
        self.pvgauge.grid(row=0,
                          column=5,
                          rowspan=3,
                          columnspan=3,
                          sticky='news')
        # Speed Gauge
        self.spdgauge = tk_tools.Gauge(self,
                                       height=200,
                                       width=400,
                                       min_value=0,
                                       max_value=20,
                                       label='Speed',
                                       unit=' (kn)',
                                       divisions=20,
                                       yellow=50,
                                       red=70)
        #bg='grey')
        self.spdgauge.grid(row=0,
                           column=2,
                           rowspan=3,
                           columnspan=3,
                           sticky='news')

        #File Name Entry Box
        self.FiNaEn = Entry(self)
        self.FiNaEn.grid(row=1, column=0)
        #File name Label
        self.FiNaLa = Label(self, text="File name:")
        self.FiNaLa.grid(row=0, column=0, sticky='S')

        #Value Labels, Digits
        self.Mag_Compass_Label = Label(self, text="Mag Compass:"******"Target Heading:")
        self.Target_Heading_Label.grid(row=4, column=0, sticky='E')

        self.Target_Heading_Dig = tk_tools.SevenSegmentDigits(
            self,
            digits=10,
            background='black',
            digit_color='white',
            height=30)
        self.Target_Heading_Dig.grid(row=4,
                                     column=1,
                                     sticky='W',
                                     pady=4,
                                     ipady=2)

        self.GPS_Compass_Label = Label(self, text="GPS Compass:"******"Latitude:")
        self.Latitude_Label.grid(row=7, column=0, sticky='E')

        self.Latitude_Dig = tk_tools.SevenSegmentDigits(self,
                                                        digits=10,
                                                        background='black',
                                                        digit_color='white',
                                                        height=30)
        self.Latitude_Dig.grid(row=7, column=1, sticky='w', pady=4, ipady=2)

        self.Longitude_Label = Label(self, text="Longitude:")
        self.Longitude_Label.grid(row=8, column=0, sticky='E')

        self.Longitude_Dig = tk_tools.SevenSegmentDigits(self,
                                                         digits=10,
                                                         background='black',
                                                         digit_color='white',
                                                         height=30)
        self.Longitude_Dig.grid(row=8, column=1, sticky='w', pady=4, ipady=2)

        self.GPS_Speed_Label = Label(self, text="GPS Speed (kn):")
        self.GPS_Speed_Label.grid(row=9, column=0, sticky='E')

        self.GPS_Speed_Dig = tk_tools.SevenSegmentDigits(self,
                                                         digits=10,
                                                         background='black',
                                                         digit_color='white',
                                                         height=30)
        self.GPS_Speed_Dig.grid(row=9, column=1, sticky='w', pady=4, ipady=2)

        self.GPS_Distance_Label = Label(self, text="GPS Distance:")
        self.GPS_Distance_Label.grid(row=10, column=0, sticky='E')

        self.GPS_Distance_Dig = tk_tools.SevenSegmentDigits(
            self,
            digits=10,
            background='black',
            digit_color='white',
            height=30)
        self.GPS_Distance_Dig.grid(row=10,
                                   column=1,
                                   sticky='w',
                                   pady=4,
                                   ipady=2)

        #Jets Labels and Digits
        self.Port_Jet_Current_Label = Label(self, text="Port Jet Current:")
        self.Port_Jet_Current_Label.grid(row=3, column=2, sticky='NESW')

        self.Port_Jet_Current_Dig = tk_tools.SevenSegmentDigits(
            self,
            digits=10,
            background='black',
            digit_color='white',
            height=30)
        self.Port_Jet_Current_Dig.grid(row=4,
                                       column=2,
                                       sticky='NEWS',
                                       pady=4,
                                       ipady=2,
                                       padx=4,
                                       ipadx=2)

        self.Delta_Jet_Current_Label = Label(self, text="Jet Current Delta:")
        self.Delta_Jet_Current_Label.grid(row=3, column=3, sticky='NESW')

        self.Delta_Jet_Current_Dig = tk_tools.SevenSegmentDigits(
            self, digits=5, background='black', digit_color='white', height=30)
        self.Delta_Jet_Current_Dig.grid(row=4,
                                        column=3,
                                        sticky='NEWS',
                                        pady=4,
                                        ipady=2,
                                        padx=4,
                                        ipadx=2)

        self.Delta_Status_Led = tk_tools.Led(self, size=50)
        self.Delta_Status_Led.grid(row=5, column=3, sticky='NSEW', ipadx=10)

        self.Starboard_Jet_Current_Label = Label(self,
                                                 text="Starboard Jet Current:")
        self.Starboard_Jet_Current_Label.grid(row=3, column=4, sticky='NESW')

        self.Starboard_Jet_Current_Dig = tk_tools.SevenSegmentDigits(
            self,
            digits=10,
            background='black',
            digit_color='white',
            height=30)
        self.Starboard_Jet_Current_Dig.grid(row=4,
                                            column=4,
                                            sticky='NEWS',
                                            pady=4,
                                            ipady=2,
                                            padx=4,
                                            ipadx=2)

        self.Log_Status_Led = tk_tools.Led(self, size=50)
        self.Log_Status_Led.grid(row=2, column=1, sticky='NSEW', ipadx=10)
        #Rotary Scale
        self.rs = tk_tools.RotaryScale(self,
                                       max_value=360,
                                       size=100,
                                       unit='deg')
        self.rs.grid(row=0, column=8, rowspan=3)

        #Start Log Button
        self.StLog = Button(self, text="Start Log", command=self.start_log)
        self.StLog.grid(row=2, column=0, sticky='N')

        self.Stop_Log = Checkbutton(self,
                                    text="Stop Logging",
                                    command=self.stop_log)
        self.Stop_Log.grid(row=0, column=1, sticky='N')
Ejemplo n.º 5
0
# button containers
# frameb = tk.Frame(frame, background='grey')
# # Lay out the main container, specify that we want it to grow with window size
# frameb.pack(fill=tk.BOTH, expand=True)
# # Allow middle cell of grid to grow when window is resized
# frameb.columnconfigure(1, weight=1)
# frameb.rowconfigure(1, weight=1)

## setup timekeeper ##

timeKeeper = TimeKeeper(frame, 220)

## setup teams ##
problemWidget = tk_tools.SevenSegmentDigits(frame,
                                            digits=8,
                                            background='black',
                                            digit_color='red',
                                            height=200)
homeTeam = Team(frame, timeKeeper, homeSignal)
visitorTeam = Team(frame, timeKeeper, visitorSignal)

## setup game buttons ##
reset_button = tk.Button(frame, text="Restart", command=restartGame)

# place widgets
timeKeeper.ssWidget.grid(row=0, column=1)
problemWidget.grid(row=1, column=1)
homeTeam.ssWidget.grid(row=3, column=0)
visitorTeam.ssWidget.grid(row=3, column=2)
reset_button.grid(row=0, column=0)
reset_button.focus()
                        fg="white",
                        command=lambda: stop_plot())
button_exit = tk.Button(window,
                        text="Exit",
                        font=("Verdana", 14),
                        padx=10,
                        pady=10,
                        command=lambda: close_window())
name_tag = tk.Label(window,
                    text="proximity distance from your sensor",
                    font=("Verdana", 18),
                    bg="White")

ss = tk_tools.SevenSegmentDigits(window,
                                 digits=4,
                                 background="white",
                                 digit_color="black",
                                 height=60)

# pack all your widgets
start_button.grid(row=3, column=0, pady=20)
stop_button.grid(row=3, column=1, pady=20)
button_exit.grid(row=4, column=0, columnspan=2)
name_tag.grid(row=2, column=0, columnspan=2)
ss.grid(row=2, column=1, pady=10)

arduino.reset_input_buffer()
window.after(1, plot_data)  # plot data every microsecond

# execute the mainloop
window.mainloop()
Ejemplo n.º 7
0
import tkinter as tk
import tk_tools
from decimal import Decimal

root = tk.Tk()

max_speed = 20.0

ss_float = tk_tools.SevenSegmentDigits(root, digits=5)
ss_float.grid(row=0, column=1, sticky='news')

ss_int = tk_tools.SevenSegmentDigits(root,
                                     digits=3,
                                     background='black',
                                     digit_color='red')
ss_int.grid(row=1, column=1, sticky='news')

count = 0
up = True


def update_gauge():
    global count, up

    if up:
        count += 0.1
        if count > max_speed:
            up = False
    else:
        count -= 0.1