PyQT Project: Tea Timer
I love tea.
My morning routine includes having a nice cup of black tea with lots of half n half. When I was working in the office I would make a stop at a Tim Hortons on my way in for a medium steeped tea with double cream to go with my breakfast sandwich. Lately I have been getting into coffee, but my love is for tea. My tastes range from a nice Yorkshire Gold to a cheap Lipton. Sometimes a cup of green tea is all I need, or at night I'm drinking an herbal with chamomile to relax. When I am sick I turn to an herbal of lemon ginger to settle my stomach, and I like to have a cup of Bubbla/Boba tea a couple times a month.
I'm not picky when it comes to how long I steep my brew. Sometimes I steep it for a couple minutes, or up to almost 5 if I want something stronger. (And sometimes even longer if I forget my tea is sitting on the counter.) Using a single-setting electric kettle means I am not picky about brewing temperature either. However, there is in fact a set of guidelines for how long and how hot to brew tea depending on the type. This is a chart I got from https://www.thespruceeats.com/tea-brewing-times-and-temperatures-1328730 that shows just the ideal temperatures and times.
Tea Brewing Times and Temperatures
| Tea Type | Celsius | Fahrenheit | Brewing Time |
| White Tea | 65-70ºC | 150-155ºF | 1-2 min. |
| Green Tea | 75-80ºC | 165-175ºF | 1-2 min. |
| Oolong Tea | 80-85ºC | 175-185ºF | 2-3 min. |
| Black Tea | 100ºC (boiling) | 210ºF | 2-3 min. |
| Herbal Tea | 100ºC (boiling) | 210ºF | 3-6 min. |
Using this information, I am creating a desktop app for those who do care how long and how hot to steep their tea.
The basic features of this program will be:
- Functions for each tea type.
- Tea name.
- Recommended brewing temperatures in Celsius and Fahrenheit.
- Recommended brewing time.
- Radio buttons to switch between tea types.
- A timer which gives noise alert when tea is done.
- Fun facts and quotes about tea.
import sys
from PySide6.QtWidgets import QApplication, QMainWindow, QWidget, QRadioButton, QGridLayout, QPushButton
# Where we display the background image.
stylesheet = """
QMainWindow {
background-image: url("C:/Users/Stars/Pictures/References/teamug2.jpg");
background-repeat: no-repeat;
background-position: center;
}
"""
# Setting up the GUI
class TeaTimer(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
self.setWindowTitle("It's Tea Time!")
self.setFixedSize(600, 400) # width, height
self._centralWidget = QWidget(self)
self.setCentralWidget(self._centralWidget)
layout = QGridLayout(self._centralWidget)
# Need to squish all this together so it looks nicer
layout.addWidget(QRadioButton("Black"))
layout.addWidget(QRadioButton("Green"))
layout.addWidget(QRadioButton("White"))
layout.addWidget(QRadioButton("Oolong"))
layout.addWidget(QRadioButton("Herbal"))
self.setLayout(layout)
# Make the functions for the different tea types
def blacktea():
"""
celsius_temp = 100
fahrenheit_temp = 210
min_time = 2 # In minutes
max_time = 6 # In minutes
:return:
"""
pass
def greentea():
"""
celsius_temp_min = 75
celsius_temp_max = 80
fahrenheit_temp_min = 165
fahrenheit_temp_max = 175
min_time = 1 # In minutes
max_time = 2 # In minutes
"""
pass
def whitetea():
"""
celsius_temp_min = 65
celsius_temp_max = 70
fahrenheit_temp_min = 150
fahrenheit_temp_max = 155
min_time = 1 # In minutes
max_time = 2 # In minutes
"""
pass
def oolongtea():
"""
celsius_temp_min = 80
celsius_temp_max = 85
fahrenheit_temp_min = 175
fahrenheit_temp_max = 185
min_time = 2 # In minutes
max_time = 3 # In minutes
"""
pass
def herbaltea():
"""
celsius_temp = 100
fahrenheit_temp = 210
min_time = 3 # In minutes
max_time = 6 # In minutes
:return:
"""
pass
if __name__ == "__main__":
app = QApplication([])
app.setStyleSheet(stylesheet)
window = TeaTimer()
window.show()
sys.exit(app.exec())

Comments
Post a Comment