Create launcher GUI #2

Merged
ndyer merged 2 commits from menu-gui into main 2022-12-20 18:20:06 -05:00
3 changed files with 38 additions and 1 deletions
Showing only changes of commit 690b69b2f4 - Show all commits

View File

36
pypong/networking/host.py Normal file
View File

@ -0,0 +1,36 @@
import psutil
class InterfaceInfo:
"""
Class used for storing interface information to make it easier to use
"""
def __init__(self, interface_name, address, subnet_mask):
self.interface_name = interface_name
self.address = address
self.subnet_mask = subnet_mask
def __str__(self):
return '(Interface:{0}, Address:{1}, Subnet Mask:{2})'.format(self.interface_name,
self.address, self.subnet_mask)
def __repr__(self):
return '(Interface:{0}, Address:{1}, Subnet Mask:{2})'.format(self.interface_name,
self.address, self.subnet_mask)
def main():
raw_interface_data = psutil.net_if_addrs()
interface_data = []
# Extract needed information from psutil and put it into a InterfaceInfo object
for interface in raw_interface_data:
address = (raw_interface_data.get(interface)[0]).address
subnet_mask = (raw_interface_data.get(interface)[0]).netmask
interface_data.append(InterfaceInfo(interface, address, subnet_mask))
print(interface_data)
if __name__ == '__main__':
main()

View File

@ -1 +1,2 @@
pygame~=2.1.2 pygame~=2.1.2
psutil~=5.9.4