0
#! /home/mehmet/anaconda3/bin/python3

from os import pipe, sep
import os
import time
import math

os.system("figlet SAYI BULMACA")

rakam1 = [[1,3,5,7,9,11,13,15],
          [17,19,21,23,25,27,29,31],
          [33,35,37,39,41,43,45,47],
          [51,53,55,57,59,61,63]]
rakam2 = [[2,3,6,7,10,11,14,15],
          [18,19,22,23,26,27,30,31],
          [34,35,38,39,42,43,46,47],
          [50,51,54,55,58,59,62,63]]
rakam3 = [[4,5,6,7,12,13,14,15],
          [20,21,22,23,28,29,30,31],
          [36,37,38,39,44,45,46,47],
          [52,53,54,55,60,61,62,63]]
rakam4 = [range(8,16),
          range(24,32),
          range(40,48),
          range(56,64)]
rakam5 = [range(16,24),
          range(24,32),
          range(48,56),
          range(56,64)]
rakam6 = [range(32,40),
          range(40,48),
          range(48,56),
          range(56,64)]          

time.sleep(2)

print("""

    Sayı bulmaca oyunumuza hoş geldiniz.

    Şimdi sizden aklınızda 1 ve 63 dahil olacak şekilde 
    1'den 63'e kadar bir sayı tutmanızı istiyorum.

    Sonrasında siz bir takım sayılar göstereceğim ve tuttuğunuz sayının
    gördüğünüz sayılar içerisinde olup olmadığını soracağım.

    Bu şekilde tuttuğunuz sayıyı bulmayaca çalışacağım.

    """)

tahmin_basla = input("Aklınızdan bir sayı tuttunuz mu?\nE/H\nBitirmek için H'ye basabilirsiniz\n")



skor = []

sayi = 0

while sayi < 1:

    if tahmin_basla == "e":
        print("İyi eğlenceler dilerim")
    else:
        print("Oyunu bitiriyorum")
        break



    for i in rakam1:
        print(*i)
    tahmin1 = input("Tutuğunuz sayı bu rakamlar içerisinde var mı?\nVAR(V) / YOK(Y)\n")
    if tahmin1 == "v":
        skor.append(int(1))

    time.sleep(1)    

    for i in rakam2:
        print(*i)
    tahmin2 = input("Tutuğunuz sayı bu rakamlar içerisinde var mı?\nVAR(V) / YOK(Y)\n")
    if tahmin2 == "v":
        skor.append(int(2))

    time.sleep(1)   

    for i in rakam3:
        print(*i)
    tahmin3 = input("Tutuğunuz sayı bu rakamlar içerisinde var mı?\nVAR(V) / YOK(Y)\n")
    if tahmin3 == "v":
        skor.append(int(4))

    time.sleep(1)   

    for i in rakam4:
        print(*i)
    tahmin4 = input("Tutuğunuz sayı bu rakamlar içerisinde var mı?\nVAR(V) / YOK(Y)\n")
    if tahmin4 == "v":
        skor.append(int(8))

    time.sleep(1)   

    for i in rakam5:
        print(*i)
    tahmin5 = input("Tutuğunuz sayı bu rakamlar içerisinde var mı?\nVAR(V) / YOK(Y)\n")
    if tahmin5 == "v":
        skor.append(int(16))

    time.sleep(1)   

    for i in rakam6:
        print(*i)
    tahmin6 = input("Tutuğunuz sayı bu rakamlar içerisinde var mı?\nVAR(V) / YOK(Y)\n")
    if tahmin6 == "v":
        skor.append(int(32))

    time.sleep(1)   

    bildin = sum(skor)

    print("Şimdi tahmin etmeye çalışıyorum...")
    time.sleep(3)
    print(f"Tuttuğunuz sayı : {bildin}\n"
            "Oynadığınız için teşekkürler\n")

    time.sleep(1)   

    sayi =+ 1

    if sayi == 1:
        sorucevap = input("Tekrar Oynamak ister misiniz?\nE/H\n")
        if sorucevap == "e":
            sayi = 0
        else:
            print("Görüşmek üzere....")
            break

Hello, I'm working with the Python language as an amateur, and a few months ago, I decided to use Ubuntu after Windows 10 and switched. Of course, I also know how to use Linux distributions at the beginner level.

I prepared the code you see above with Visual Studio Code and saved it with a .py extension.

My goal is to:

As in Windows, I want the code to run by double-clicking the file and close it after a person uses it. When running, it does not matter whether it is a window or a terminal screen.

First of all, I have to point out that I tried several ways for this process:

  1. pyinstaller -F filename.py I created an exe into dist / file it didn't work.

  2. I tried it with chmod u + x filename.

  3. I activated the ask option when opening the properties. I don't want him to ask me what will happen after double-clicking

  4. I created a file with a .desktop extension. I have pasted codes into it (I don't know if the codes are correct.)

As a result, I could not do anything.

Can someone please explain in detail what to do?

2 Answers2

-1

SOLVED

my problem is solved

exec = gnome-terminal -e "python3 file path / filename.py" >>> all problem is this

my problem was solved.

[Desktop Entry] Version = 1.0 Type = Application Name = Run Comment = Terminal Execution Exec = gnome-terminal -e "python3 /home/here is username/Desktop/Myprograms/Shortcut.py" Icon = emblem-dropbox-syncing Path = Terminal = false StartupNotify = false

-1

There is an error in the first line of your script. There should be no space between shebang (#!) and the path to Python interpreter (/home/mehmet/anaconda3/bin/python3 - also check if this path is correct and fix it if not). If you remove this and make the file executable, it should run after double click.

raj
  • 11,409