<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>python on HpLeapfrog&#39;s Blog</title>
    <link>https://www.hpleapfrog.cn/categories/python/</link>
    <description>Recent content in python on HpLeapfrog&#39;s Blog</description>
    <generator>Hugo -- gohugo.io</generator>
    <lastBuildDate>Sat, 26 Mar 2022 14:35:06 +0000</lastBuildDate><atom:link href="https://www.hpleapfrog.cn/categories/python/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Python全局变量申明和使用</title>
      <link>https://www.hpleapfrog.cn/post/2022-03-26-python%E5%85%A8%E5%B1%80%E5%8F%98%E9%87%8F%E7%94%B3%E6%98%8E%E5%92%8C%E4%BD%BF%E7%94%A8/</link>
      <pubDate>Sat, 26 Mar 2022 14:35:06 +0000</pubDate>
      
      <guid>https://www.hpleapfrog.cn/post/2022-03-26-python%E5%85%A8%E5%B1%80%E5%8F%98%E9%87%8F%E7%94%B3%E6%98%8E%E5%92%8C%E4%BD%BF%E7%94%A8/</guid>
      <description>在函数外直接申明变量 在函数内使用时提前说明:groble 变量,才能正常修改 不能像C语言一样直接在函数内修改变量值 如果要在函数内修改全局变量的值，只要在函数内部用 ​global​ 声明这个全局变量，就能在函数内修改这全局变量的值。 num = 1 # 这是一个全局变量 为了美观我把他放在第一行 def update(): #</description>
    </item>
    
    <item>
      <title>Python打包图片于EXE文件中</title>
      <link>https://www.hpleapfrog.cn/post/2022-03-04-python%E6%89%93%E5%8C%85%E5%9B%BE%E7%89%87%E4%BA%8Eexe%E6%96%87%E4%BB%B6%E4%B8%AD/</link>
      <pubDate>Fri, 04 Mar 2022 12:34:27 +0000</pubDate>
      
      <guid>https://www.hpleapfrog.cn/post/2022-03-04-python%E6%89%93%E5%8C%85%E5%9B%BE%E7%89%87%E4%BA%8Eexe%E6%96%87%E4%BB%B6%E4%B8%AD/</guid>
      <description>下面是将打包数据文件的绝对路径转为相对路径的一个脚本，利用的是os的path模块和 sys._MEIPASS： from os import path import sys bundle_dir = getattr(sys, &amp;lsquo;_MEIPASS&amp;rsquo;, path.abspath(path.dirname(file))) path_to_dat = path.join(bundle_dir, &amp;lsquo;other-file.dat&amp;rsquo;) 将这个脚本加入到主脚本文件中，用转换的路径代替原来脚本中数据文件的绝对路径即可。打包数据可以利用&amp;ndash;add-data命令或者使用.s</description>
    </item>
    
    <item>
      <title>Python tkinterGUI使用</title>
      <link>https://www.hpleapfrog.cn/post/2022-03-04-python-tkintergui%E4%BD%BF%E7%94%A8/</link>
      <pubDate>Fri, 04 Mar 2022 08:52:20 +0000</pubDate>
      
      <guid>https://www.hpleapfrog.cn/post/2022-03-04-python-tkintergui%E4%BD%BF%E7%94%A8/</guid>
      <description>Tkinter 是 Python 的标准 GUI 库。Python 使用 Tkinter 可以快速的创建 GUI 应用程序。 由于 Tkinter 是内置到 python 的安装包中、只要安装好 Python 之后就能 import Tkinter 库、而且 IDLE 也是用 Tkinter 编写而成、对于简单的图形界面 Tkinter 还是能应付自如。 tkinter 按钮button 参数说明： height: 按钮的高度，如未设置此项，其大小以适应按钮的内容（文本或图片的大小） width: 按</description>
    </item>
    
  </channel>
</rss>
