taliwind+pyodide实现浏览器中离线直接运行python代码的webos操作系统代码

代码语言:html

所属分类:布局界面

代码描述:taliwind+pyodide实现浏览器中离线直接运行python代码的webos操作系统代码,支持多窗口,计算器、画图、备忘录,浏览器、系统监控、文件管理、python代码运行、锁屏、系统设置,桌面操作等ui操作。

代码标签: taliwind pyodide 浏览器 离线 直接 运行 python 代码 webos 操作

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>WebOS</title>
    <script src="https://cdn.jsdelivr.net/pyodide/v0.26.1/full/pyodide.js"></script>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            user-select: none;
        }

        :root {
            --accent: #0078d4;
            --accent-light: #429ce3;
            --glass-bg: rgba(255, 255, 255, 0.72);
            --glass-border: rgba(255, 255, 255, 0.3);
            --shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
            --taskbar-height: 48px;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
            overflow: hidden;
            height: 100vh;
            width: 100vw;
        }

        /* Desktop */
        #desktop {
            width: 100%;
            height: 100%;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            background-size: cover;
            position: relative;
            transition: filter 0.5s;
        }

        #desktop.blurred {
            filter: blur(8px) brightness(0.7);
        }

        /* Desktop Icons */
        #desktop-icons {
            padding: 20px;
            display: flex;
            flex-direction: column;
            flex-wrap: wrap;
            height: calc(100vh - var(--taskbar-height) - 40px);
            gap: 8px;
        }

        .desktop-icon {
            width: 80px;
            height: 90px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 6px;
            border-radius: 8px;
            cursor: pointer;
            transition: background 0.2s;
            padding: 8px;
        }

        .desktop-icon:hover {
            background: rgba(255, 255, 255, 0.15);
        }

        .desktop-icon:active {
            background: rgba(255, 255, 255, 0.25);
        }

        .desktop-icon .icon {
            font-size: 36px;
            line-height: 1;
        }

        .desktop-icon .label {
            font-size: 11px;
            color: white;
            text-align: center;
            text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
            word-break: break-all;
        }

        /* Taskbar */
        #taskbar {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            height: var(--taskbar-height);
            background: rgba(24, 24, 24, 0.85);
            backdrop-filter: blur(20px);
            display: flex;
            align-items: center;
            padding: 0 8px;
            z-index: 9000;
            border-top: 1px solid rgba(255, 255, 255, 0.08);
        }

        #start-btn {
            width: 40px;
            height: 40px;
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: background 0.2s;
            font-size: 20px;
        }

        #start-btn:hover {
            background: rgba(255, 255, 255, 0.1);
        }

        #taskbar-apps {
            flex: 1;
            display: flex;
            align-items: center;
            padding: 0 12px;
            gap: 4px;
            overflow-x: auto;
        }

        .taskbar-item {
            height: 36px;
            padding: 0 12px;
            border-radius: 6px;
            display: flex;
            align-items: center;
            gap: 6px;
            cursor: pointer;
            transition: background 0.2s;
            white-space: nowrap;
            font-size: 12px;
            color: #ccc;
        }

        .taskbar-item:hover {
            background: rgba(255, 255, 255, 0.1);
        }

        .taskbar-item.active {
            background: rgba(255, 255, 255, 0.15);
            color: white;
        }

        #system-tray {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 0 12px;
            color: #ccc;
            font-size: 12px;
        }

        #system-tray .tray-icon {
            cursor: pointer;
            font-size: 14px;
        }

        #clock {
            cursor: pointer;
            text-align: right;
            line-height: 1.3;
        }

        /* Start Menu */
        #start-menu {
            position: fixed;
            bottom: calc(var(--taskbar-height) + 8px);
            left: 8px;
            width: 320px;
            max-height: 480px;
            background: rgba(32, 32, 32, 0.92);
            backdrop-filter: blur(20px);
            border-radius: 12px;
            border: 1px solid rgba(255, 255, 255, 0.08);
            box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
            display: none;
            flex-direction: column;
            overflow: hidden;
            z-index: 9500;
            animation: menuSlideUp 0.2s ease;
        }

        @keyframes menuSlideUp {
            from { transform: translateY(10px); opacity: 0; }
            to { transform: translateY(0); opacity: 1; }
        }

        #start-menu.show {
            display: flex;
        }

        #start-menu-search {
            padding: 16px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        }

        #start-menu-search input {
            width: 100%;
            height: 36px;
            border-radius: 18px;
            border: 1px solid rgba(255, 255, 255, 0.1);
            background: rgba(255, 255, 255, 0.05);
            color: white;
            padding: 0 16px;
            font-size: 13px;
            outline: none;
            transition: border-color 0.2s;
        }

        #start-menu-search input:focus {
            border-color: var(--accent);
        }

        #start-menu-apps {
            padding: 12px;
            overflow-y: auto;
            flex: 1;
        }

        .start-menu-item {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 10px 12px;
            border-radius: 8px;
            cursor: pointer;
            transition: background 0.2s;
            color: #ddd;
        }

        .start-menu-item:hover {
            background: rgba(255, 255, 255, 0.08);
        }

        .start-menu-item .item-icon {
            font-size: 24px;
            width: 36px;
            text-align: center;
        }

        .start-menu-item .item-info {
            flex: 1;
        }

        .start-menu-item .item-name {
            font-size: 13px;
            font-weight: 500;
        }

        .start-menu-item .item-desc {
            font-size: 11px;
            color: #888;
            margin-top: 2px;
        }

        #start-menu-footer {
            padding: 12px 16px;
            border-top: 1px solid rgba(255, 255, 255, 0.06);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .power-btn {
            padding: 6px 12px;
            border-radius: 6px;
            cursor: pointer;
            color: #ccc;
            font-size: 12px;
            transition: background 0.2s;
        }

        .power-btn:hover {
            background: rgba(255, 255, 255, 0.1);
        }

        /* Windows */
        .window {
            position: absolute;
            min-width: 300px;
            min-height: 200px;
            background: rgba(32, 32, 32, 0.95);
            backdrop-filter: blur(20px);
            border-radius: 12px;
            border: 1px solid rgba(255, 255, 255, 0.08);
            box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
            display: flex;
            flex-direction: column;
            overflow: hidden;
            transition: box-shadow 0.2s;
        }

        .window.focused {
            box-shadow: 0 16px 56px rgba(0, 0, 0, 0.5);
            border-color: rgba(255, 255, 255, 0.12);
        }

        .window.maximized {
            top: 0 !important;
            left: 0 !important;
            width: 100% !important;
            height: calc(100% - var(--taskbar-height)) !important;
            border-radius: 0;
        }

        .window.minimized {
            display: none;
        }

        .window-titlebar {
            height: 36px;
            display: flex;
            align-items: center;
            padding: 0 12px;
            gap: 8px;
            cursor: default;
            flex-shrink: 0;
            background: rgba(0, 0, 0, 0.2);
        }

        .window-titlebar .win-icon {
            font-size: 14px;
        }

        .window-title {
            flex: 1;
            font-size: 12px;
            color: #ccc;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .window-controls {
            display: flex;
            gap: 2px;
        }

        .window-controls button {
            width: 28px;
            height: 28px;
            border: none;
            background: transparent;
            color: #aaa;
            cursor: pointer;
            border-radius: 6px;
            font-size: 12px;
            display: flex;
            align-items: center;
          .........完整代码请登录后点击上方下载按钮下载查看

网友评论0