Compare commits
3 Commits
690b69b2f4
...
main
Author | SHA1 | Date | |
---|---|---|---|
5c1a61f25c | |||
ffaedd821b | |||
10ce4f1595 |
@@ -1 +1 @@
|
|||||||
recursive-include pypong *
|
recursive-include pynpong *
|
@@ -1,4 +1,4 @@
|
|||||||
# PyPong
|
# PynPong
|
||||||
[](LICENSE)
|
[](LICENSE)
|
||||||
|
|
||||||
A game of pong made in PyGame, designed to be used over a network connection.
|
A game of pong made in PyGame, designed to be used over a network connection.
|
66
pynpong/networking/gui.py
Normal file
66
pynpong/networking/gui.py
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
"""
|
||||||
|
Starting launcher of the game. This is where you host new games or join other ones.
|
||||||
|
"""
|
||||||
|
import tkinter as tk
|
||||||
|
|
||||||
|
global running
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
"""
|
||||||
|
Runs the game launcher.
|
||||||
|
"""
|
||||||
|
main_window = tk.Tk()
|
||||||
|
main_window.title('PynPong Launcher')
|
||||||
|
main_window.resizable(width=False, height=False)
|
||||||
|
|
||||||
|
main_window.geometry('500x250')
|
||||||
|
|
||||||
|
def quit_launcher():
|
||||||
|
"""
|
||||||
|
Quits the main menu.
|
||||||
|
"""
|
||||||
|
global running
|
||||||
|
running = False
|
||||||
|
|
||||||
|
def get_games():
|
||||||
|
"""
|
||||||
|
Refresh the games list.
|
||||||
|
"""
|
||||||
|
listbox.delete(0, tk.END)
|
||||||
|
listbox.insert(0, 'Searching for games...')
|
||||||
|
# Networking code will go here eventually
|
||||||
|
|
||||||
|
# Create the top title label
|
||||||
|
title_label = tk.Label(text='PynPong Launcher', fg='white', bg='#000040', padx=1, pady=20)
|
||||||
|
title_label.pack(side=tk.TOP, fill=tk.BOTH)
|
||||||
|
|
||||||
|
# Create the list of games
|
||||||
|
listbox = tk.Listbox(main_window)
|
||||||
|
listbox.pack(side=tk.LEFT, expand=True, fill=tk.BOTH)
|
||||||
|
# Add scrollbar
|
||||||
|
scrollbar = tk.Scrollbar(main_window)
|
||||||
|
scrollbar.pack(side=tk.LEFT, fill=tk.Y)
|
||||||
|
# Link scrollbar to list of games
|
||||||
|
listbox.config(yscrollcommand=scrollbar.set)
|
||||||
|
scrollbar.config(command=listbox.yview)
|
||||||
|
|
||||||
|
# Create buttons
|
||||||
|
button_frame = tk.Frame(main_window)
|
||||||
|
tk.Button(button_frame, text='Host a Game', height=3, width=30).pack()
|
||||||
|
tk.Button(button_frame, text='Join Selected Game', height=3, width=30).pack()
|
||||||
|
tk.Button(button_frame, text='Refresh Game List', height=2, width=20, command=get_games).pack()
|
||||||
|
button_frame.pack(side=tk.RIGHT)
|
||||||
|
|
||||||
|
# Set it so that if the X is pressed the application quits
|
||||||
|
main_window.protocol('WM_DELETE_WINDOW', quit_launcher)
|
||||||
|
|
||||||
|
global running
|
||||||
|
running = True
|
||||||
|
|
||||||
|
while running:
|
||||||
|
main_window.update()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
6
setup.py
6
setup.py
@@ -1,5 +1,5 @@
|
|||||||
import setuptools
|
import setuptools
|
||||||
import pypong
|
import pynpong
|
||||||
|
|
||||||
with open('requirements.txt') as fh:
|
with open('requirements.txt') as fh:
|
||||||
required = fh.read().splitlines()
|
required = fh.read().splitlines()
|
||||||
@@ -9,13 +9,13 @@ with open('README.md', 'r') as fh:
|
|||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name='PyPong',
|
name='PyPong',
|
||||||
version=pypong.__version__,
|
version=pynpong.__version__,
|
||||||
author='Nicholas Dyer',
|
author='Nicholas Dyer',
|
||||||
description='A game of pong made in PyGame for play over a local network',
|
description='A game of pong made in PyGame for play over a local network',
|
||||||
license='GNU GPL-3.0',
|
license='GNU GPL-3.0',
|
||||||
long_description=long_description,
|
long_description=long_description,
|
||||||
long_description_content_type='text/markdown',
|
long_description_content_type='text/markdown',
|
||||||
url='https://gitea.citruxx.com/ndyer/PyPong',
|
url='https://gitea.citruxx.com/ndyer/PynPong',
|
||||||
packages=setuptools.find_packages(),
|
packages=setuptools.find_packages(),
|
||||||
# https://pypi.org/classifiers/
|
# https://pypi.org/classifiers/
|
||||||
classifiers=[
|
classifiers=[
|
||||||
|
Reference in New Issue
Block a user