Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to make basic inventory setup in python

"""
-==basic inventory setup=--
"""


from math import ulp
import os
import keyboard
import time

#starter
os.system('cls' if os.name == 'nt' else 'clear')
inventory = 1

#discriptions
print("1)press e to open your inventory
2)press the number dat you wont to print
3)press p to print
4)press left or right keys to go btwin 1 to 9
(press d to delete all)")

while True:
    #key detecter
    inputer = keyboard.read_key()
    time.sleep(0.2)

    #inventory print
    if inputer == "p":
        if inventory == 1:
            print("-")
        else:
            if inventory == 2:
                print("--")
            else:
                if inventory == 3:
                    print("---")
                else:
                    if inventory == 4:
                        print("----")
                    else:
                        if inventory == 5:
                            print("-----")
                        else:
                            if inventory == 6:
                                print("------")
                            else:
                                if inventory == 7:
                                    print("-------")
                                else:
                                    if inventory == 8:
                                        print("--------")
                                    else:
                                        if inventory == 9:
                                            print("---------")

    #inventory show

    if inputer == "e":
        print("[1] -
[2] --
[3] ---
[4] ----
[5] -----
[6] ------
[7] -------
[8] --------
[9] ---------
[selected] %s" % inventory)

    #print deliter
    if inputer == "d":
        os.system('cls' if os.name == 'nt' else 'clear')

    #inventory selecter
    if inputer == "left":
        inventory -= 1
    if inputer == "right":
        inventory += 1

    if inventory == 10:
        inventory = 1
    if inventory == 0:
        inventory = 9

    if inputer == "1":
        inventory = 1
    if inputer == "2":
        inventory = 2
    if inputer == "3":
        inventory = 3
    if inputer == "4":
        inventory = 4
    if inputer == "5":
        inventory = 5
    if inputer == "6":
        inventory = 6
    if inputer == "7":
        inventory = 7
    if inputer == "8":
        inventory = 8
    if inputer == "9":
        inventory = 9
Comment

PREVIOUS NEXT
Code Example
Python :: pandas join two columns 
Python :: change size of yticks python 
Python :: python counter get most common 
Python :: copy a 2d array in python 
Python :: download stopwords nltk 
Python :: How to use PatBlt in Python 
Python :: upload multiple files streamlit 
Python :: ImportError: No module named _tkinter, please install the python-tk package 
Python :: gdscript top-down 2d movement 
Python :: how to make pyautogui search a region of the screen 
Python :: How to efficiently find the first index in an array of distinct numbers that is equal to the value at that index? 
Python :: only int validator PyQt 
Python :: python how to check which int var is the greatest 
Python :: firebase-admin python 
Python :: python show png 
Python :: python pandas how to load csv file 
Python :: não nulo pandas 
Python :: how to write a font in pygame 
Python :: subprocess the system cannot find the file specified 
Python :: how to set the size of a gui in python 
Python :: how to factorise an expression in python 
Python :: python generate list alphabet 
Python :: wxpython custom dialog 
Python :: matplotlib Savefig cuts off title 
Python :: pygame flip image 
Python :: python for i in directory 
Python :: print nested list in new lines 
Python :: number guessing game python 
Python :: how to exit the program in pygame 
Python :: django read mesage 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =