Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding new project(WebButtonSimpelGUI) #284

Merged
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
11 changes: 11 additions & 0 deletions projects/WebButtonSimpelGUI/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# WebButtonSimpelGUI

# Project Description

This project is a simple GUI application built using Python and the Tkinter library. It consists some buttons, each associated with a different action. Clicking on Button 1 opens Google in the default web browser, Button 2 opens YouTube, and Button 3 opens GitHub (just for example).

The project demonstrates how to create a basic GUI application using Tkinter and how to handle button clicks to perform specific actions such as opening web pages. The icons for the buttons can be customized by providing the respective image paths or URLs.

To run the project, ensure you have the necessary dependencies installed (Tkinter and Pillow) and execute the script. The main window with the buttons will appear, allowing you to interact with the application.

Feel free to clone or download the repository and modify the code according to your requirements.
37 changes: 37 additions & 0 deletions projects/WebButtonSimpelGUI/WebButtonSimpelGUI.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#Dont forget to import icon path
import webbrowser as wb
import tkinter as tk
from PIL import Image, ImageTk

def button1_click():
print("Button 1 clicked!")
wb.open("https://www.google.com/")
def button2_click():
print("Button 2 clicked!")
wb.open("https://www.youtube.com/")
def button3_click():
print("Button 3 clicked!")
wb.open("https://github.com/")

# Create the main window
window = tk.Tk()

# Load the button icons
button1_icon = ImageTk.PhotoImage(Image.open("<ICON1_PATH>"))
button2_icon = ImageTk.PhotoImage(Image.open("<ICON2_PATH>"))
button3_icon = ImageTk.PhotoImage(Image.open("<ICON3_PATH>"))

# Create the buttons with custom icons
button1 = tk.Button(window, image=button1_icon, command=button1_click)
button2 = tk.Button(window, image=button2_icon, command=button2_click)
button3 = tk.Button(window, image=button3_icon, command=button3_click)

# Pack the buttons to add them to the window
button1.pack()
button2.pack()
button3.pack()

# Start the main event loop
window.mainloop()


Loading