コード例 #1
0
ファイル: Widget.py プロジェクト: noQ/MoonLanding
 def __init__(self,
                 w=None,
                 steps=100,
                 position=None,
                 color=BLACK,
                 width=None,
                 height=10,
                 fill=1,
                 border=0,
                 borderColor=WHITE):
     if width is None:
         width = conf.WINWIDTH - 50
         
     self.original_color = color
     self.set_color(color)
     self.width = width
     self.height = height
     
     Rectangle.__init__(self, w, width, height, color=color)
     self.image.set_colorkey(TRANSPARENT)
     if position is None:
         self.center(y=-20)
     else:
         self.set_position(position)
         
     self.fill_bar = fill
     self.add_progress(steps)
     self.set_collision_rect(self.image.get_rect())
コード例 #2
0
ファイル: Widget.py プロジェクト: noQ/MoonLanding
 def __init__(self,
                 w=None,
                 steps=100,
                 position=None,
                 color=BLACK,
                 width=10,
                 height=None,
                 fill=1):
     if height is None:
         height = conf.WINHEIGHT-60
     self.original_color = color
     self.set_color(color)
     self.width = width
     self.height = height
     Rectangle.__init__(self, w, width, height, color=color)
     self.image.set_colorkey(TRANSPARENT)
     if position is None:
         self.center(x=30)
     else:
         self.set_position(position)
     self.fill_bar = fill
     self.add_progress(steps)
     self.set_collision_rect(self.image.get_rect())
コード例 #3
0
from Graphics import Circle, Rectangle
from Graphics.ThreeDGraphics.Cuboid import *
from Graphics.ThreeDGraphics import Sphere as s

r = int(input("Enter the radius:"))
print("Area of the given circle=", Circle.area(r))
print("Perimeter of the given circle=", Circle.perimeter(r))
print("____________________________________________________")

l = int(input("\nEnter length of the rectangle:"))
b = int(input("Enter the breadth of the rectangle:"))
print("Area of the given rectangle=", Rectangle.area(l, b))
print("Perimeter of the given rectangle=", Rectangle.perimeter(l, b))
print("____________________________________________________")

l = int(input("\nEnter length of the cuboid:"))
b = int(input("Enter breadth of the cuboid:"))
h = int(input("Enter height of the cuboid:"))
print("Area of the given cuboid=", area(l, b, h))
print("Perimeter of the given cuboid=", perimeter(l, b, h))
print("____________________________________________________")

r = int(input("\nEnter the radius of the sphere:"))
print("Area of the given sphere=", s.area(r))
print("Perimeter of the given circle=", s.perimeter(r))
print("____________________________________________________")