Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. |
Expand All @@ -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.

## Gitpod

In the cloud-free development environment where you can directly start coding.
Expand Down
1 change: 1 addition & 0 deletions To Do App/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- To run, you need to install QT to install type `pip install PySide6` in terminal.
88 changes: 88 additions & 0 deletions To Do App/main.py
Original file line number Diff line number Diff line change
@@ -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_())