鱼C论坛

 找回密码
 立即注册
查看: 1043|回复: 3

easygui--记住用户的设置

[复制链接]
发表于 2018-4-2 19:16:18 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
  1. #-----------------------------------------------------------------------
  2. # create "settings", a persistent Settings object
  3. # Note that the "filename" argument is required.
  4. # The directory for the persistent file must already exist.
  5. #-----------------------------------------------------------------------
  6. import os
  7. settingsFilename = os.path.join("C:", "FishCApp", "settings.txt")  # Windows example
  8. settings = Settings(settingsFilename)
复制代码
  1. # we initialize the "user" and "server" variables
  2. # In a real application, we'd probably have the user enter them via enterbox
  3. user    = "奥巴马"
  4. server  = "白宫"

  5. # we save the variables as attributes of the "settings" object
  6. settings.userId = user
  7. settings.targetServer = server
  8. settings.store()    # persist the settings

  9. # run code that gets a new value for userId
  10. # then persist the settings with the new value
  11. user    = "小甲鱼"
  12. settings.userId = user
  13. settings.store()
复制代码

运行出来出错了,如图片所示。为什么呢?
SFF`{~DIBRU566DFIXBIGJ0.png
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2018-4-2 19:19:28 | 显示全部楼层
没定义
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2018-4-3 12:16:37 | 显示全部楼层

settings是自己定义么?两个都是settings = dict()?
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2018-4-3 12:20:31 | 显示全部楼层
小咪的旅途 发表于 2018-4-3 12:16
settings是自己定义么?两个都是settings = dict()?

settings = Settings()
这个类没见过,你自己定义的么,也没见你加载什么模块
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-12-29 01:57

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表