From 39d0294aaad7d8fcfe8bc824ea17025aa4362ca5 Mon Sep 17 00:00:00 2001 From: yousif <138237408+yousifj129@users.noreply.github.com> Date: Wed, 26 Jun 2024 04:51:23 +0300 Subject: [PATCH 1/3] made a to do app Create README.md --- To Do App/README.md | 1 + To Do App/main.py | 88 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 To Do App/README.md create mode 100644 To Do App/main.py diff --git a/To Do App/README.md b/To Do App/README.md new file mode 100644 index 0000000..e5fd0bd --- /dev/null +++ b/To Do App/README.md @@ -0,0 +1 @@ +- To run, you need to install QT to install type `pip install PySide6` in terminal. \ No newline at end of file diff --git a/To Do App/main.py b/To Do App/main.py new file mode 100644 index 0000000..64171c2 --- /dev/null +++ b/To Do App/main.py @@ -0,0 +1,88 @@ +import sys +from PySide6.QtWidgets import QApplication, QMainWindow, QWidget, QVBoxLayout, QHBoxLayout, QListWidget, QLineEdit, \ + QPushButton, QSizePolicy +from PySide6.QtGui import QFont +class ToDoListApp(QMainWindow): + def __init__(self): + super().__init__() + self.setWindowTitle("PyToDo: To-Do List App") + self.setGeometry(200, 200, 400, 400) + + self.central_widget = QWidget(self) + self.setCentralWidget(self.central_widget) + + self.layout = QVBoxLayout() + self.central_widget.setLayout(self.layout) + + self.task_list = QListWidget() + self.layout.addWidget(self.task_list) + + self.task_input = QLineEdit() + self.layout.addWidget(self.task_input) + + self.add_button = QPushButton("Add Task") + self.add_button.clicked.connect(self.add_task) + self.layout.addWidget(self.add_button) + + self.task_widgets = [] + + def add_task(self): + task_text = self.task_input.text() + if task_text: + task_widget = QWidget() + task_layout = QHBoxLayout(task_widget) + + + font = QFont() + font.setPointSize(10) + + + task_label = QPushButton(task_text) + task_label.setCheckable(False) + task_label.setChecked(False) + task_label.clicked.connect(self.update_task_status) + task_label.setFont(font) + task_label.adjustSize() + + delete_button = QPushButton("Done") + delete_button.clicked.connect(lambda: self.delete_task(task_widget)) + delete_button.setFixedWidth(70) # Adjust the width as needed + delete_button.setFont(font) + delete_button.adjustSize() + + task_label.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum) + delete_button.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Minimum) + task_widget.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum) + + + task_layout.addWidget(task_label) + task_layout.addWidget(delete_button) + task_layout.setContentsMargins(0, 0, 0, 0) + task_layout.setSpacing(1) + + self.task_list.addItem("") + self.task_list.setItemWidget(self.task_list.item(self.task_list.count() - 1), task_widget) + self.task_widgets.append((task_widget, task_label, delete_button)) + + self.task_input.clear() + + def delete_task(self, task_widget): + for index, (widget, _, _) in enumerate(self.task_widgets): + if widget == task_widget: + self.task_list.takeItem(index) + self.task_widgets.pop(index) + break + def update_task_status(self): + task_label = self.sender() + for _, label, _ in self.task_widgets: + if label == task_label: + label.setChecked(task_label.isChecked()) + break + + +if __name__ == "__main__": + + app = QApplication(sys.argv) + todo_app = ToDoListApp() + todo_app.show() + sys.exit(app.exec_()) \ No newline at end of file From a1bf1b2998717b6c43f14e629a70b4cce89212a6 Mon Sep 17 00:00:00 2001 From: yousif <138237408+yousifj129@users.noreply.github.com> Date: Wed, 17 Jul 2024 12:12:17 +0300 Subject: [PATCH 2/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fc12058..9a8f46b 100644 --- a/README.md +++ b/README.md @@ -123,7 +123,7 @@ More information on contributing and the general code of conduct for discussion | Youtube Downloader | [Youtube Downloader](https://github.com/DhanushNehru/Python-Scripts/tree/master/Youtube%20Downloader) | Downloads any video from [YouTube](https://youtube.com) in video or audio format! | Pigeonhole Sort | [Algorithm](https://github.com/DhanushNehru/Python-Scripts/tree/master/PigeonHole) | the pigeonhole sort algorithm to sort your arrays efficiently! | Youtube Playlist Info Scraper | [Youtube Playlist Info Scraper](https://github.com/DhanushNehru/Python-Scripts/tree/master/Youtube%20Playlist%20Info%20Scraper) | This python module retrieve information about a YouTube playlist in json format using playlist link. - +| Todo list | [To Do App](https://github.com/DhanushNehru/Python-Scripts/tree/master/To%20Do%20App) | Graphical todo list app ## Gitpod In the cloud-free development environment where you can directly start coding. From c392392b6158b3c4fd6ad3e86767103f09813543 Mon Sep 17 00:00:00 2001 From: yousif <138237408+yousifj129@users.noreply.github.com> Date: Wed, 17 Jul 2024 14:06:16 +0300 Subject: [PATCH 3/3] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9a8f46b..3fdf599 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,8 @@ More information on contributing and the general code of conduct for discussion | Text to Image | [Text to Image](https://github.com/DhanushNehru/Python-Scripts/tree/master/Text%20to%20Image) | A Python script that will take your text and convert it to a JPEG. | | Tic Tac Toe 1 | [Tic Tac Toe](https://github.com/DhanushNehru/Python-Scripts/tree/master/Tic-Tac-Toe) | A game of Tic Tac Toe. | | Tik Tac Toe 2 | [Tik Tac Toe](https://github.com/DhanushNehru/Python-Scripts/tree/master/Tic-Tac-Toe%202) | A game of Tik Tac Toe. | +| Todo list | [To Do App](https://github.com/DhanushNehru/Python-Scripts/tree/master/To%20Do%20App) | +Graphical todo list app | Turtle Art & Patterns | [Turtle Art](https://github.com/DhanushNehru/Python-Scripts/tree/master/Turtle%20Art) | Scripts to view turtle art also have prompt-based ones. | | Turtle Graphics | [Turtle Graphics](https://github.com/DhanushNehru/Python-Scripts/tree/master/Turtle%20Graphics) | Code using turtle graphics. | | Twitter Selenium Bot | [Twitter Selenium Bot](https://github.com/DhanushNehru/Python-Scripts/tree/master/Twitter%20Selenium%20Bot) | A bot that can interact with Twitter in a variety of ways. | @@ -123,7 +125,6 @@ More information on contributing and the general code of conduct for discussion | Youtube Downloader | [Youtube Downloader](https://github.com/DhanushNehru/Python-Scripts/tree/master/Youtube%20Downloader) | Downloads any video from [YouTube](https://youtube.com) in video or audio format! | Pigeonhole Sort | [Algorithm](https://github.com/DhanushNehru/Python-Scripts/tree/master/PigeonHole) | the pigeonhole sort algorithm to sort your arrays efficiently! | Youtube Playlist Info Scraper | [Youtube Playlist Info Scraper](https://github.com/DhanushNehru/Python-Scripts/tree/master/Youtube%20Playlist%20Info%20Scraper) | This python module retrieve information about a YouTube playlist in json format using playlist link. -| Todo list | [To Do App](https://github.com/DhanushNehru/Python-Scripts/tree/master/To%20Do%20App) | Graphical todo list app ## Gitpod In the cloud-free development environment where you can directly start coding.