pptx nasıl kullanırım

mustafa kızgınçelik 0 Reputation points
2025-11-18T21:06:57.16+00:00

from pptx import Presentation

from pptx.util import Inches, Pt

from pptx.enum.text import PP_ALIGN

Sunum oluştur

prs = Presentation()

--- SLAYT 1: BAŞLIK ---

slide_layout = prs.slide_layouts[0] # Başlık slaydı

slide = prs.slides.add_slide(slide_layout)

title = slide.shapes.title

subtitle = slide.placeholders[1]

title.text = "Ego mu Servet mi?"

subtitle.text = "Finansal Başarının İki Farklı Yolu\n\n'Haklı Olmak Yerine Kazanmaya Odaklanmak'"

--- SLAYT 2: PARADOKS ---

slide_layout = prs.slide_layouts[1] # Başlık ve İçerik

slide = prs.slides.add_slide(slide_layout)

title = slide.shapes.title

content = slide.placeholders[1]

title.text = "Kural 1: Ya Haklısın Ya Zengin"

tf = content.text_frame

p = tf.add_paragraph()

p.text = '"Ya haklı olursunuz ya da zengin... ama ikisi birlikte olamazsınız."'

p.font.bold = True

p.font.size = Pt(24)

p = tf.add_paragraph()

p.text = "Neden?"

p.level = 0

p.font.bold = True

p = tf.add_paragraph()

p.text = "Haklı Olmak (EGO): İnat ister, kendi fikrini dayatır."

p.level = 1

p = tf.add_paragraph()

p.text = "Zengin Olmak (SERVET): Esneklik ister, yanıldığını kabul eder, strateji değiştirir."

p.level = 1

--- SLAYT 3: EGO'NUN MALİYETİ ---

slide_layout = prs.slide_layouts[1]

slide = prs.slides.add_slide(slide_layout)

title = slide.shapes.title

content = slide.placeholders[1]

title.text = "Ego'nun Finansal Bedeli (Haklı Olma Yolu)"

tf = content.text_frame

p = tf.add_paragraph()

p.text = '"Ego servet yemez, servet ego yer."'

p.font.italic = True

p.font.size = Pt(22)

p = tf.add_paragraph()

p.text = "Temel Hatalar:"

p.font.bold = True

p.level = 0

p = tf.add_paragraph()

p.text = "Piyasayı kendine uydurmaya çalışmak (Pahalı bir hırs)."

p.level = 1

p = tf.add_paragraph()

p.text = "Duygularla karar vermek (Hissetmek > Gerçekler)."

p.level = 1

p = tf.add_paragraph()

p.text = "Onaylama Yanlılığı: Sadece kendini doğrulayan veriyi görmek."

p.level = 1

--- SLAYT 4: ZENGİNLİĞİN ZİHNİYETİ ---

slide_layout = prs.slide_layouts[1]

slide = prs.slides.add_slide(slide_layout)

title = slide.shapes.title

content = slide.placeholders[1]

title.text = "Zenginliğin Zihniyeti (Kazanma Yolu)"

tf = content.text_frame

p = tf.add_paragraph()

p.text = "Kural: Zengin olmaya çalışan, kendini piyasaya uydurur."

p.font.bold = True

p.font.size = Pt(22)

p = tf.add_paragraph()

p.text = "Nasıl Davranırlar?"

p.level = 0

p = tf.add_paragraph()

p.text = "Yanıldığını hızlı kabul eder (Zararı keser)."

p.level = 1

p = tf.add_paragraph()

p.text = "'Ben demiştim' ihtiyacını çöpe atar."

p.level = 1

p = tf.add_paragraph()

p.text = "Hesabı dinler, duyguları değil verileri baz alır."

p.level = 1

--- SLAYT 5: SONUÇ ---

slide_layout = prs.slide_layouts[1]

slide = prs.slides.add_slide(slide_layout)

title = slide.shapes.title

content = slide.placeholders[1]

title.text = "Seçim Senin, Kader Senin"

tf = content.text_frame

p = tf.add_paragraph()

p.text = "Özetle:"

p.level = 0

p = tf.add_paragraph()

p.text = "Haklı çıkmaya değil, kazanmaya odaklanırsan zengin olursun."

p.font.size = Pt(24)

p.level = 1

p = tf.add_paragraph()

p.text = "" # Boşluk

p = tf.add_paragraph()

p.text = '"İkisinin yolu farklıdır; seçtiğin yol kaderini belirler."'

p.font.bold = True

p.font.color.rgb = None # Varsayılan renk

p.alignment = PP_ALIGN.CENTER

p.font.size = Pt(28)

Dosyayı kaydet

file_path = "/mnt/data/Ego_vs_Servet_Sunum.pptx"

prs.save(file_path)

file_path

Microsoft 365 and Office | PowerPoint | For home | Android
0 comments No comments

1 answer

Sort by: Most helpful
  1. AI answer

    2025-11-18T21:07:19.34+00:00

    To use the pptx library in Python for creating a PowerPoint presentation, you can follow the example code you provided. Here’s a brief explanation of how it works:

    1. Import the Library: You start by importing the necessary classes from the pptx module.
    2. Create a Presentation: You create a new presentation object using Presentation().
    3. Add Slides: You can add different types of slides using slide_layouts. For example, prs.slide_layouts[0] is used for a title slide, while prs.slide_layouts[1] is for a title and content slide.
    4. Set Titles and Content: You can set the title and content of each slide using the shapes.title and placeholders attributes.
    5. Format Text: You can format the text by changing properties such as font size, boldness, and alignment.
    6. Save the Presentation: Finally, you save the presentation to a specified file path using prs.save(file_path).

    This allows you to create a structured PowerPoint presentation programmatically, which can be useful for automating report generation or creating presentations from data.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.