Jump to content

I am so tired just help me

Need_Not

Ok so I am kinda board so I decided to teach myself python and make a basic stat app with the hypixel api 

So basically I put this 

import hypixel

API_KEYS = ['Not giving you my key']
hypixel.setKeys(API_KEYS)

Player = hypixel.Player('Need_Not')

Guild = hypixel.Guild('Bad Wifi')

PlayerName = Player.getName() # This gets the player's name and puts it in a variable called "PlayerName". :3
print("Player name: ", end='')
print(PlayerName)

PlayerRank = Player.getRank()
print("rank: ", end='')
print(PlayerRank['rank'])

PlayerLevel = Player.getLevel()
print("level: ", end='')
print(PlayerLevel) # This prints the level that we got, two lines up!

playerInfo = Player.getPlayerInfo()
print('UUID' + ": ", end='')
print(playerInfo['uuid'])


GuildID = Player.getGuildID()
print('Guild: ', end='')
print(GuildID)

print("")
print("Bedwars")
print("")

playerJSON = Player.JSON
playerJSON['stats']['Bedwars']

playerJSON = Player.JSON
playerJSON['achievements']
print('Bedwars Level: ', end='')
bwlevel = (playerJSON['achievements']['bedwars_level'])
cbwlevel = '{:,}'.format(bwlevel)
print(cbwlevel)

print('Coins: ', end='')
bwcoins = (playerJSON['stats']['Bedwars']['coins'])
cbwcoins = '{:,}'.format(bwcoins)
print(cbwcoins)

print('Winstreak: ', end='')
ws = (playerJSON['stats']['Bedwars']['winstreak'])
cws = '{:,}'.format(ws)
print(cws)

print('')

print('Iron Collected: ', end='')
ironss = (playerJSON['stats']['Bedwars']['iron_resources_collected_bedwars'])
ciron = '{:,}'.format(ironss)
print(ciron)

print('Gold Collected: ', end='')
goldd = (playerJSON['stats']['Bedwars']['gold_resources_collected_bedwars'])
cgold = '{:,}'.format(goldd)
print(cgold)

print('Diamonds Collected: ', end='')
diamondss = (playerJSON['stats']['Bedwars']['diamond_resources_collected_bedwars'])
cdiamond = '{:,}'.format(diamondss)
print(cdiamond)

print('Emeralds Collected: ', end='')
ems = (playerJSON['stats']['Bedwars']['emerald_resources_collected_bedwars'])
cems = '{:,}'.format(ems)
print(cems)



print('')

print("SOLO:")


playerJSON = Player.JSON
playerJSON['stats']['Bedwars']
print('Kills: ', end='')
bw = (playerJSON['stats']['Bedwars']['eight_one_kills_bedwars'])
cbw = '{:,}'.format(bw)
print(cbw)

print('Deaths: ', end='')
bw1 = (playerJSON['stats']['Bedwars']['eight_one_deaths_bedwars'])
cbw1 = '{:,}'.format(bw1)
print(cbw1)

e = int(playerJSON['stats']['Bedwars']['eight_one_deaths_bedwars'])
f = int(playerJSON['stats']['Bedwars']['eight_one_kills_bedwars'])
g =  f / e

print('K/D Ratio: ', end='')
cg = '{:,.2f}'.format(g)
print(cg)

print("")

print('Final Kills: ', end='')
bw2 = (playerJSON['stats']['Bedwars']['eight_one_final_kills_bedwars'])
cbw2 = '{:,}'.format(bw2)
print(cbw2)


print('Final Deaths: ', end='')
bw3 = (playerJSON['stats']['Bedwars']['eight_one_final_deaths_bedwars'])
cbw3 = '{:,}'.format(bw3)
print(cbw3)

a = int(playerJSON['stats']['Bedwars']['eight_one_final_deaths_bedwars'])
b = int(playerJSON['stats']['Bedwars']['eight_one_final_kills_bedwars'])
c = b / a
print('Final K/D Ratio: ', end='')
cc = '{:,.2f}'.format(c)
print(cc)

print("")

print('Wins: ', end='')
bw4 = (playerJSON['stats']['Bedwars']['eight_one_wins_bedwars'])
cbw4 = '{:,}'.format(bw4)
print(cbw4)

print('Losses: ', end='')
bw5 = (playerJSON['stats']['Bedwars']['eight_one_losses_bedwars'])
cbw5 = '{:,}'.format(bw5)
print(cbw5)

h = int(playerJSON['stats']['Bedwars']['eight_one_wins_bedwars'])
i = int(playerJSON['stats']['Bedwars']['eight_one_losses_bedwars'])
j = h / i

print('W/L ratio: ', end='')
cj = '{:,.2f}'.format(j)
print(cj)

print("")
print("DOUBLES:")

playerJSON = Player.JSON
playerJSON['stats']['Bedwars']
print('Kills: ', end='')
bw6 = (playerJSON['stats']['Bedwars']['eight_two_kills_bedwars'])
cbw6 = '{:,}'.format(bw6)
print(cbw6)

print('Deaths: ', end='')
bw7 = (playerJSON['stats']['Bedwars']['eight_two_deaths_bedwars'])
cbw7 = '{:,}'.format(bw7)
print(cbw7)

e1 = int(playerJSON['stats']['Bedwars']['eight_two_deaths_bedwars'])
f1 = int(playerJSON['stats']['Bedwars']['eight_two_kills_bedwars'])
g1 =  f1 / e1

print('K/D Ratio: ', end='')
cg1 = '{:,.2f}'.format(g1)
print(cg1)


print("")

print('Final Kills: ', end='')
bw8 = (playerJSON['stats']['Bedwars']['eight_two_final_kills_bedwars'])
cbw8 = '{:,}'.format(bw8)
print(cbw8)


print('Final Deaths: ', end='')
bw9 = (playerJSON['stats']['Bedwars']['eight_two_final_deaths_bedwars'])
cbw9 = '{:,}'.format(bw9)
print(cbw9)


a1 = int(playerJSON['stats']['Bedwars']['eight_two_final_deaths_bedwars'])
b1 = int(playerJSON['stats']['Bedwars']['eight_two_final_kills_bedwars'])
c1 = b1 / a1
print('Final K/D Ratio: ', end='')
cc1 = '{:,.2f}'.format(c1)
print(cc1)


print("")

print('Wins: ', end='')
bw10 = (playerJSON['stats']['Bedwars']['eight_two_wins_bedwars'])
cbw10 = '{:,}'.format(bw10)
print(cbw10)


print('Losses: ', end='')
bw11 = (playerJSON['stats']['Bedwars']['eight_two_losses_bedwars'])
cbw11 = '{:,}'.format(bw11)
print(cbw11)

h1 = int(playerJSON['stats']['Bedwars']['eight_two_wins_bedwars'])
i1 = int(playerJSON['stats']['Bedwars']['eight_two_losses_bedwars'])
j1 = h1 / i1

print('W/L ratio: ', end='')
cj1 = '{:,.2f}'.format(j1)
print(cj1)

print("")
print("3v3v3v3:")

playerJSON = Player.JSON
playerJSON['stats']['Bedwars']
print('Kills: ', end='')
bw12 = (playerJSON['stats']['Bedwars']['four_three_kills_bedwars'])
cbw12 = '{:,}'.format(bw12)
print(cbw12)

print('Deaths: ', end='')
bw13 = (playerJSON['stats']['Bedwars']['four_three_deaths_bedwars'])
cbw13 = '{:,}'.format(bw13)
print(cbw13)

e2 = int(playerJSON['stats']['Bedwars']['four_three_deaths_bedwars'])
f2 = int(playerJSON['stats']['Bedwars']['four_three_kills_bedwars'])
g2 =  f2 / e2

print('K/D Ratio: ', end='')
cg2 = '{:,.2f}'.format(g2)
print(cg2)

print("")

print('Final Kills: ', end='')
bw13 = (playerJSON['stats']['Bedwars']['four_three_final_kills_bedwars'])
cbw13 = '{:,}'.format(bw13)
print(cbw13)

print('Final Deaths: ', end='')
bw14 = (playerJSON['stats']['Bedwars']['four_three_final_deaths_bedwars'])
cbw14 = '{:,}'.format(bw14)
print(cbw14)

a2 = int(playerJSON['stats']['Bedwars']['four_three_final_deaths_bedwars'])
b2 = int(playerJSON['stats']['Bedwars']['four_three_final_kills_bedwars'])
c2 = b2 / a2
print('Final K/D Ratio: ', end='')
cc2 = '{:,.2f}'.format(c2)
print(cc2)

print("")

print('Wins: ', end='')
bw15 = (playerJSON['stats']['Bedwars']['four_three_wins_bedwars'])
cbw15 = '{:,}'.format(bw15)
print(cbw15)

print('Losses: ', end='')
bw16 = (playerJSON['stats']['Bedwars']['four_three_losses_bedwars'])
cbw16 = '{:,}'.format(bw16)
print(cbw16)


h2 = int(playerJSON['stats']['Bedwars']['four_three_wins_bedwars'])
i2 = int(playerJSON['stats']['Bedwars']['four_three_losses_bedwars'])
j2 = h2 / i2

print('W/L ratio: ', end='')
cj2 = '{:,.2f}'.format(j2)
print(cj2)

print("")
print("4v4v4v4:")

playerJSON = Player.JSON
playerJSON['stats']['Bedwars']
print('Kills: ', end='')
bw17 = (playerJSON['stats']['Bedwars']['four_four_kills_bedwars'])
cbw17 = '{:,}'.format(bw17)
print(cbw17)


print('Deaths: ', end='')
bw18 = (playerJSON['stats']['Bedwars']['four_four_deaths_bedwars'])
cbw18 = '{:,}'.format(bw18)
print(cbw18)

e3 = int(playerJSON['stats']['Bedwars']['four_four_deaths_bedwars'])
f3 = int(playerJSON['stats']['Bedwars']['four_four_kills_bedwars'])
g3 =  f3 / e3

print('K/D Ratio: ', end='')
cg3 = '{:,.2f}'.format(g3)
print(cg3)

print("")

print('Final Kills: ', end='')
bw19 = (playerJSON['stats']['Bedwars']['four_four_final_kills_bedwars'])
cbw19 = '{:,}'.format(bw19)
print(cbw19)

print('Final Deaths: ', end='')
bw20 = (playerJSON['stats']['Bedwars']['four_four_final_deaths_bedwars'])
cbw20 = '{:,}'.format(bw20)
print(cbw20)

a3 = int(playerJSON['stats']['Bedwars']['four_four_final_deaths_bedwars'])
b3 = int(playerJSON['stats']['Bedwars']['four_four_final_kills_bedwars'])
c3 = b3 / a3
print('Final K/D Ratio: ', end='')
cc3 = '{:,.2f}'.format(c3)
print(cc3)

print("")

print('Wins: ', end='')
bw21 = (playerJSON['stats']['Bedwars']['four_four_wins_bedwars'])
cbw21 = '{:,}'.format(bw21)
print(cbw21)

print('Losses: ', end='')
bw22 = (playerJSON['stats']['Bedwars']['four_four_losses_bedwars'])
cbw22 = '{:,}'.format(bw22)
print(cbw22)

h3 = int(playerJSON['stats']['Bedwars']['four_four_wins_bedwars'])
i3 = int(playerJSON['stats']['Bedwars']['four_four_losses_bedwars'])
j3 = h3 / i3

print('W/L ratio: ', end='')
cj3 = '{:,.2f}'.format(j3)
print(cj3)

print("")

print("Overall:")

ki55 = f + f1 + f2 + f3
de4 = e + e1 + e2 + e3
kd54 = ki55 / de4
fki55 = b + b1 + b2 + b3
fde4 = a + a1 + a2 + a3
fkd54 = fki55 / fde4
aw = h + h1 + h2 + h3
al = i + i1 + i2 + i3
wl = aw / al

print('Kills: ', end='')
cki55 = '{:,}'.format(ki55)
print(cki55)

print('Deaths: ', end='')
cde4 = '{:,}'.format(de4)
print(cde4)

print('K/D Ratio: ', end='')
ckd54 = '{:,.2f}'.format(kd54)
print(ckd54)

print("")

print('Final kills: ', end='')
cfki55 = '{:,}'.format(fki55)
print(cfki55)

print('Final Deaths: ', end='')
cfde4 = '{:,}'.format(fde4)
print(cfde4)

print('Final K/D Ratio: ', end='')
cfkd54 = '{:,.2f}'.format(fkd54)
print(cfkd54)


print("")

print('Wins: ', end='')
caw = '{:,}'.format(aw)
print(caw)

print('Losses: ', end='')
cal = '{:,}'.format(al)
print(cal)

print('W/L Ratio: ', end='')
cwl = '{:,.2f}'.format(wl)
print(cwl)

and it outputs like this 

Player name: Need_Not
rank: MVP+
level: 75.55549743589744
UUID: 29e391aae42f475ca232e4dfe692fe33
Guild: 5d73024077ce84a6473ff833

Bedwars

Bedwars Level: 176
Coins: 505,367
Winstreak: 0

Iron Collected: 304,485
Gold Collected: 46,421
Diamonds Collected: 3,541
Emeralds Collected: 3,428

SOLO:
Kills: 84
Deaths: 190
K/D Ratio: 0.44

Final Kills: 9
Final Deaths: 16
Final K/D Ratio: 0.56

Wins: 2
Losses: 24
W/L ratio: 0.08

DOUBLES:
Kills: 256
Deaths: 496
K/D Ratio: 0.52

Final Kills: 68
Final Deaths: 167
Final K/D Ratio: 0.41

Wins: 15
Losses: 162
W/L ratio: 0.09

3v3v3v3:
Kills: 1,403
Deaths: 2,620
K/D Ratio: 0.54

Final Kills: 419
Final Deaths: 342
Final K/D Ratio: 1.23

Wins: 196
Losses: 341
W/L ratio: 0.57

4v4v4v4:
Kills: 3,202
Deaths: 5,434
K/D Ratio: 0.59

Final Kills: 732
Final Deaths: 709
Final K/D Ratio: 1.03

Wins: 323
Losses: 720
W/L ratio: 0.45

Overall:
Kills: 4,945
Deaths: 8,740
K/D Ratio: 0.57

Final kills: 1,228
Final Deaths: 1,234
Final K/D Ratio: 1.00

Wins: 536 
Losses: 1,247
W/L Ratio: 0.43

cool right? the only problem is... it runs in console so other people without python can't use it :( so add a GUI! 

and that is what I need help with! is adding a gui.

I have tried tKinter but i just and not satisfied 

So i want to see if I can't get help from people that have done this before.

So i am thinking of having a window that opens and asks for an api key (the user has to use their own because I don't want mine to be public) and idk if this is possible but have a window pop up that says enter api key and then a text box 

they paste their key in then press enter and by doing that it writes the key down for next time 

then if the key is already in it will then go to  page that says "enter player name" and when they enter a name and press enter it = namex (x to be unique) and i got the rest from there

but my main problem is making something that prints in console print on a window and then in this code right here it only shows bedwars stats but if i add other games how do i make it like spoilers so like it looks like this 

Spoiler

Bedwars Level: 176
Coins: 505,367

Winstreak: 0

Iron Collected: 304,485
Gold Collected: 46,421
Diamonds Collected: 3,541
Emeralds Collected: 3,428

SOLO:
Kills: 84
Deaths: 190
K/D Ratio: 0.44

Final Kills: 9
Final Deaths: 16
Final K/D Ratio: 0.56

Wins: 2
Losses: 24
W/L ratio: 0.08

DOUBLES:
Kills: 256
Deaths: 496
K/D Ratio: 0.52

Final Kills: 68
Final Deaths: 167
Final K/D Ratio: 0.41

Wins: 15
Losses: 162
W/L ratio: 0.09

3v3v3v3:
Kills: 1,403
Deaths: 2,620
K/D Ratio: 0.54

Final Kills: 419
Final Deaths: 342
Final K/D Ratio: 1.23

Wins: 196
Losses: 341
W/L ratio: 0.57

4v4v4v4:
Kills: 3,202
Deaths: 5,434
K/D Ratio: 0.59

Final Kills: 732
Final Deaths: 709
Final K/D Ratio: 1.03

Wins: 323
Losses: 720
W/L ratio: 0.45

Overall:
Kills: 4,945
Deaths: 8,740
K/D Ratio: 0.57

Final kills: 1,228
Final Deaths: 1,234
Final K/D Ratio: 1.00

Wins: 536
Losses: 1,247
W/L Ratio: 0.43

 

so like a thing that says bedwars and when clicked it becomes the full stats

 

AND one more thing... can i make it so i still use print tags that way ik that it will work with the api place holders and i dont have to recode it 

 

also like i said i am new so ik nothing about how to make a gui 

so i am asking if this can be done and the best way for me to do it 

 

 

 

 

Just some random guy who has a gaming computer to play on his Minecraft server

Link to comment
Share on other sites

Link to post
Share on other sites

Doing this because you’re bored, yet you’re also incredibly tired.  I know nothing about python, but it sounds like you need to go to bed.

Not a pro, not even very good.  I’m just old and have time currently.  Assuming I know a lot about computers can be a mistake.

 

Life is like a bowl of chocolates: there are all these little crinkly paper cups everywhere.

Link to comment
Share on other sites

Link to post
Share on other sites

21 minutes ago, Bombastinator said:

Doing this because you’re bored, yet you’re also incredibly tired.  I know nothing about python, but it sounds like you need to go to bed.

Well... I have been working on this since Sunday or Monday and I am tired of searching for frameworks and ways of doing this that it's not even fun so I am seeing if I can make the answer come to me not go to it

Just some random guy who has a gaming computer to play on his Minecraft server

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, Need_Not said:

Well... I have been working on this since Sunday or Monday and I am tired of searching for frameworks and ways of doing this that it's not even fun so I am seeing if I can make the answer come to me not go to it

Even if you add a GUI, people would still need Python, unless you find a way to compile it into a self-contained .exe (which, on the other hand, does not mandate a GUI)

 

Might be easier to go with another language like C# and Visual Studio that comes with a GUI toolkit out of the box (and includes a compiler that produces an executable). Requires .Net, but that comes pre-installed on Windows these days.

 

Remember to either quote or @mention others, so they are notified of your reply

Link to comment
Share on other sites

Link to post
Share on other sites

10 minutes ago, Eigenvektor said:

unless you find a way to compile it into a self-contained .exe

That's not a problem at all.

F@H
Desktop: i9-13900K, ASUS Z790-E, 64GB DDR5-6000 CL36, RTX3080, 2TB MP600 Pro XT, 2TB SX8200Pro, 2x16TB Ironwolf RAID0, Corsair HX1200, Antec Vortex 360 AIO, Thermaltake Versa H25 TG, Samsung 4K curved 49" TV, 23" secondary, Mountain Everest Max

Mobile SFF rig: i9-9900K, Noctua NH-L9i, Asrock Z390 Phantom ITX-AC, 32GB, GTX1070, 2x1TB SX8200Pro RAID0, 2x5TB 2.5" HDD RAID0, Athena 500W Flex (Noctua fan), Custom 4.7l 3D printed case

 

Asus Zenbook UM325UA, Ryzen 7 5700u, 16GB, 1TB, OLED

 

GPD Win 2

Link to comment
Share on other sites

Link to post
Share on other sites

18 minutes ago, Eigenvektor said:

Even if you add a GUI, people would still need Python, unless you find a way to compile it into a self-contained .exe (which, on the other hand, does not mandate a GUI)

 

Might be easier to go with another language like C# and Visual Studio that comes with a GUI toolkit out of the box (and includes a compiler that produces an executable). Requires .Net, but that comes pre-installed on Windows these days.

 

 

You can use pyinstaller which handle everything including the .dlls and executable so users can run them without a python interpretor. I wouldn't recommend it though. If you want native code, try doing everything in C or C++.

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

36 minutes ago, Eigenvektor said:

Even if you add a GUI, people would still need Python, unless you find a way to compile it into a self-contained .exe (which, on the other hand, does not mandate a GUI)

 

Might be easier to go with another language like C# and Visual Studio that comes with a GUI toolkit out of the box (and includes a compiler that produces an executable). Requires .Net, but that comes pre-installed on Windows these days.

 

So then what does it print in?

 

Also could i use visual studio for python gui? Or just c#?

Just some random guy who has a gaming computer to play on his Minecraft server

Link to comment
Share on other sites

Link to post
Share on other sites

27 minutes ago, Need_Not said:

So then what does it print in?

 

Also could i use visual studio for python gui? Or just c#?

You don't need anything more complicated than a text editor. In fact, you can write the entire thing on notepad(not that you should). I would suggest you just use pycharm IDE for coding and debugging. 

 

Issue with pythinker is that you do not get any gui assisted designer tools like that of windows form in which you can just drag and drop widgets. Instead, you are pretty much gonna be hardcoding everything, including the positions and whatnots, kinda like writing raw html and css I suppose but more tedious. 

 

As an alternative to pythinker, you can use something like pyqt5 which happens to be my favorite gui framework. You will then have access to qt creator designer tool for form creation. I know you don't want to learn a new framework but you will have to, there is no way around it.

 

Introduction to qt designer tool and how to get it working with pyqt5

 

Introduction to pyqt5 framework

 

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

You can definitely use tkinter for everything you mentioned. Qt is probably better though.

Don't ask to ask, just ask... please 🤨

sudo chmod -R 000 /*

Link to comment
Share on other sites

Link to post
Share on other sites

7 hours ago, wasab said:

You don't need anything more complicated than a text editor. In fact, you can write the entire thing on notepad(not that you should). I would suggest you just use pycharm IDE for coding and debugging. 

 

Issue with pythinker is that you do not get any gui assisted designer tools like that of windows form in which you can just drag and drop widgets. Instead, you are pretty much gonna be hardcoding everything, including the positions and whatnots, kinda like writing raw html and css I suppose but more tedious. 

 

As an alternative to pythinker, you can use something like pyqt5 which happens to be my favorite gui framework. You will then have access to qt creator designer tool for form creation. I know you don't want to learn a new framework but you will have to, there is no way around it.

 

Introduction to qt designer tool and how to get it working with pyqt5

 

Introduction to pyqt5 framework

 

I used there pyqt4 designer and it was awesome so I bet qt5 will be better the only thing is I can't figure out how to make a .ui to .py

Just some random guy who has a gaming computer to play on his Minecraft server

Link to comment
Share on other sites

Link to post
Share on other sites

I still can't get pyqt5 to work but i have a new idea 

When the user opens the program a small window pops up it says "Enter a player name"

the user then puts a player name and presses a buttom "enter" the name they just inputted should then = namex (unique again) 

and then I put he namex variable in the 

Player = hypixel.Player('Need_Not')

part making it so the user can look up any player they want

 

then when they press enter a new window pops up with all the stats 

but and then i think i can do the rest but anyone know how to make an entry do that? 

Just some random guy who has a gaming computer to play on his Minecraft server

Link to comment
Share on other sites

Link to post
Share on other sites

You could try something simpler like Sciter : https://sciter.com/

There's Python bindings for it : https://pypi.org/project/PySciter/

 

Then all you have to do is distribute the .dll with your application.

 

It's a HTML + CSS + Javascript like script support, you make your interface like a html file and engine creates the window with the text boxes and whatever.

 

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

ok so new plans once again!

 

is it possible to make all text made with (print) display on a gui or is that only for console?

Just some random guy who has a gaming computer to play on his Minecraft server

Link to comment
Share on other sites

Link to post
Share on other sites

On 11/29/2019 at 7:16 AM, Eigenvektor said:

Might be easier to go with another language like C# and Visual Studio that comes with a GUI toolkit out of the box (and includes a compiler that produces an executable). Requires .Net, but that comes pre-installed on Windows these days.

I would say throw flask on it and return as json then html front end .

 

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×