Skip to content

Instantly share code, notes, and snippets.

@sulincix
Created March 28, 2024 18:27
Show Gist options
  • Save sulincix/b66acdb684170246345dadd50f9e05b9 to your computer and use it in GitHub Desktop.
Save sulincix/b66acdb684170246345dadd50f9e05b9 to your computer and use it in GitHub Desktop.
31 power calculator
#!/usr/bin/env python3
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, GLib
main = Gtk.Window()
button = Gtk.Button()
label = Gtk.Label()
stack = Gtk.Stack()
count = 0
def stop():
global count
stack.set_visible_child_name("finish")
status = ""
if count < 50:
status = "anime kızı"
elif count < 80:
status = "idare eder"
elif count < 100:
status = "erkek adam"
else:
status = "gerçek 31ci"
label.set_text("Sonuç:"+ str(count/10.0)+" cp/s\n"+ status)
count = 0
def cps(widget):
global count
if(count == 0):
GLib.timeout_add(10000, stop)
count+=1
widget.set_label(str(count))
main.add(stack)
stack.add_named(button, "start")
stack.add_named(label, "finish")
main.show_all()
main.set_size_request(400, 400)
button.connect("clicked", cps)
Gtk.main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment