欢迎光临散文网 会员登陆 & 注册

weaenia 1.0发布

2023-02-17 13:33 作者:自制地铁和天文望远镜  | 我要投稿

代码:

import ybc_box as box

import ybc_ui

import ybc_translation


box.msgbox('Weaenia 1.0')

a = ['新闻','天气','关机']

b = box.buttonbox('你要用',a)

if b == '新闻':

  # News:

  import ybc_box as box

  import urllib.request as rq

  import ybc_data as new


  ty = new.news_channel()

  op = box.buttonbox('Head news in today',ty)

  if op == None:

    box.msgbox('Good luck')

  else:

    flag = new.news(op)

    j = 0

    for i in flag:

      if i[2] != '':

        rq.urlretrieve(i[2],str(j)+'.jpg')

        j = j+1

        p = box.msgbox(i[0]+'\n'+i[1],i[2])

        if p == None:

          x = box.buttonbox('You want to:',['choice','exit'])

          if x == 'choice':

            op = box.buttonbox('Head news in today',ty)

            if op == None:

              box.msgbox('Thank you reading')

              break   

          else:

            box.msgbox('Thank you reading')

            break

      else:

        p = box.msgbox(i[0]+'\n'+i[1],i[2])

        if p == None:

          x = box.buttonbox('You want to:',['choice','exit'])

          if x == 'choice':

            op = box.buttonbox('Head news in today',ty)

            if op == None:

              box.msgbox('Thank you reading')

              break   

          else:

            box.msgbox('Thank you reading')

            break

elif b == '天气' :

  # Weathers:

  import ybc_ai

  import ybc_ui

  import ybc_data

  import ybc_box as box

  r=['星期一','星期二','星期三','星期四','星期五','星期六','星期天']

  t=ybc_data.china_cities()

  while True :

    xz = box.buttonbox('欢迎来到 Weaenia 天气查询小程序',['查询','退出'])

    if xz == '查询':

      box.msgbox('欢迎来到 Weaenia 天气查询小程序')

      f = box.buttonbox('请选择你想查询的城市',t)

      e = box.buttonbox('你想查询周几的天气呢?',r)   

      l = ybc_data.weather_week(f)

      if e == '星期一':

        s1 = l[4][0] + '天气预报' + '\n'

        s3 = '温度:' + l[4][3] + '\n'

        s4 = '天气:' + l[4][4] + '\n'

        s = s1 + s3 + s4

      elif e == '星期二':

        s1 = l[5][0] + '天气预报' + '\n'

        s3 = '温度:' + l[5][3] + '\n'

        s4 = '天气:' + l[5][4] + '\n'

        s = s1 + s3 + s4

      elif e == '星期三':

        s1 = l[6][0] + '天气预报' + '\n'

        s3 = '温度:' + l[6][3] + '\n'

        s4 = '天气:' + l[6][4] + '\n'

        s = s1 + s3 + s4

      elif e == '星期四':

        s1 = l[0][0] + '天气预报' + '\n'

        s3 = '温度:' + l[0][3] + '\n'

        s4 = '天气:' + l[0][4] + '\n'

        s = s1 + s3 + s4

      elif e == '星期五':

        s1 = l[1][0] + '天气预报' + '\n'

        s3 = '温度:' + l[1][3] + '\n'

        s4 = '天气:' + l[1][4] + '\n'

        s = s1 + s3 + s4

      elif e == '星期六':

        s1 = l[2][0] + '天气预报' + '\n'

        s3 = '温度:' + l[2][3] + '\n'

        s4 = '天气:' + l[2][4] + '\n'

        s = s1 + s3 + s4

      elif e == '星期天':

        s1 = l[3][0] + '天气预报' + '\n'

        s3 = '温度:' + l[3][3] + '\n'

        s4 = '天气:' + l[3][4] + '\n'


      box.msgbox(s)

    elif xz == '退出':

      break

weaenia 1.0发布的评论 (共 条)

分享到微博请遵守国家法律