Khamidov πŸ—½Python
124 subscribers
86 photos
18 videos
34 files
32 links
πŸ‘‹Assalomu aleykum menπŸ‘¨β€πŸ’»
@Mr_developer616z πŸ‘¨β€πŸ’»

Python developer's channel
Download Telegram
This media is not supported in your browser
VIEW IN TELEGRAM
batman symbol.py
1.2 KB
import turtle

#initialize method
bat = turtle.Turtle()

#size of pointer and pen
bat.turtlesize(1, 1, 1)
bat.pensize(3)

#screen info
wn = turtle.Screen()
wn.bgcolor("black")
wn.title("BATMAN")

#colour
bat.color("crimson", "yellow")


#begin filling color
bat.begin_fill()

#turn1
bat.left(90) # turn pointer direction to left of 90'
bat.circle(50, 85) #draw circle of radius = 50 and 85'
bat.circle(15, 110)
bat.right(180)

#turn 2
bat.circle(30, 150)
bat.right(5)
bat.forward(10) #draw forward line of 10 units

#turn 3
bat.right(90)
bat.circle(-70, 140)
bat.forward(40)
bat.right(110)

#turn 4
bat.circle(100, 30)
bat.circle(30, 100)
bat.left(50)
bat.forward(50)
bat.right(145)

#turn5
bat.forward(30)
bat.left(55)
bat.forward(10)

#reverse

#turn 5
bat.forward(10)
bat.left(55)
bat.forward(30)

#turn 4

bat.right(145)
bat.forward(50)
bat.left(50)
bat.circle(30, 100)
bat.circle(100, 30)

#turn 3
bat.right(90)
bat.right(20)
bat.forward(40)
bat.circle(-70, 140)

#turn 2
bat.right(90)
bat.forward(10)
bat.right(5)
bat.circle(30, 150)

#turn 1
bat.left(180)
bat.circle(15, 110)
bat.circle(50, 85)

#end color filling
bat.end_fill()



#end the turtle method
turtle.done()
Pythonda funksiya va modu.pptx
72.1 KB
e'lon.py
288 B
πŸ•³Robocontest uz misollarining javoblarini tashlab tursak nima deysiz🧐 Hamma tezda robocontest.uz saytida akkaunt ochsin men yordam beraman
import tkinter as tk
from tkinter import messagebox

class TicTacToe(tk.Tk):
def __init__(self):
super().__init__()
self.title("Tic Tac Toe")
self.geometry("300x300")
self.current_player = "X"
self.board = [" " for _ in range(9)]
self.create_buttons()

def create_buttons(self):
self.buttons = []
for i in range(3):
for j in range(3):
button = tk.Button(self, text="", font=("Arial", 20), width=4, height=2,
command=lambda i=i, j=j: self.on_button_click(i, j))
button.grid(row=i, column=j, sticky="nsew")
self.buttons.append(button)

def on_button_click(self, i, j):
index = 3 * i + j
if self.board[index] == " ":
self.board[index] = self.current_player
self.buttons[index].config(text=self.current_player)
if self.check_winner():
messagebox.showinfo("O'yin tugadi", f"Player {self.current_player} yutdi!")
self.reset_game()
elif " " not in self.board:
messagebox.showinfo("O'yin tugadi", "DURRANG!")
self.reset_game()
else:
self.toggle_player()

def check_winner(self):
winning_combinations = ((0, 1, 2), (3, 4, 5), (6, 7, 8),
(0, 3, 6), (1, 4, 7), (2, 5, 8),
(0, 4, 8), (2, 4, 6))
for combo in winning_combinations:
if (self.board[combo[0]] == self.board[combo[1]] == self.board[combo[2]]
!= " "):
return True
return False

def toggle_player(self):
self.current_player = "O" if self.current_player == "X" else "X"

def reset_game(self):
self.board = [" " for _ in range(9)]
for button in self.buttons:
button.config(text="")
self.current_player = "X"

if __name__ == "__main__":
app = TicTacToe()
app.mainloop()
tkinter_x_o_o'yini.py
2 KB
Khamidov πŸ—½Python
πŸ•³Robocontest uz misollarining javoblarini tashlab tursak nima deysiz🧐 Hamma tezda robocontest.uz saytida akkaunt ochsin men yordam beraman
Ha mi❓birinchi misoldan boshlab beraymi
Anonymous Poll
93%
Ha
7%
Yo'q
Sizga tkinter kutubxonasidagi 'bgcolor', 'pencolor', 'fillcolor', 'batcolor' nomli funksiyalar haqida ma'lumot beraman:

- 'bgcolor' funksiyasi, fon rangini sozlash uchun ishlatiladi.
- 'pencolor' funksiyasi, rasm ustida ish qiladigan bezakni sozlash uchun ishlatiladi.
- 'fillcolor' funksiyasi, shaklning ichidagi to'ldiruvchi bezakni sozlash uchun ishlatiladi.
- 'batcolor' funksiyasi, ko'chiruvchi ob'ektning bezagini sozlash uchun ishlatiladi.

Undan tashqari, 'turtle' modulida bir nechta boshqa asosiy funksiyalar mavjud, masalan:

- 'circle' funksiyasi, berilgan radiusga ega bo'lgan doirani chizadi.
- 'forward' funksiyasi, turtle ob'ektini berilgan masofa yo'nalishida oldiradi.
- 'right' funksiyasi, turtle ob'ektini berilgan burchakda o'ngga aylantiradi.
Botdan obunachi kerak bolsa qoshib bermasa hammasini ertaga ozim qoshib beraman
Yashil rangning ikki xil varianti:("green")
Tepadagi yashil("lime")
Pastdagi yashil("chartreuse")
βˆ†_βˆ†_ranglar_farqi.py
1.2 KB
Ranglar_colors.py
Yozuvim sal xunukroq😁.
Qaysi rangni tushunmasangiz so'rang kommentda.O'zingiz ham tajribada sinab ko'ring python turtle kutubxonasida
Ranglar_colors.py
This media is not supported in your browser
VIEW IN TELEGRAM